[squeak-dev] The Inbox: Graphics-cbc.372.mcz

Chris Cunningham cunningham.cb at gmail.com
Wed Mar 29 14:37:18 UTC 2017


Hi,

yes, / vs // is definitely worth the effort.  For this use case, I am
utilizing Rectangle to represent rectangles that I want to place in a Visio
drawing, and that representation uses fractional measurements (inches, say)
instead of pixels.

A better question is should I be using Rectangle for this.  Maybe we should
create a 'TrueRectangle' class or something similar so that we can actually
talk about and share what can really be done with rectangles, instead of
the 'ScreenRectangle' that we have today called Rectangle.

That said, this change does let me work with rectangle for this purpose,
but it does move the class away from our pixel based rectangle.

-cbc

On Wed, Mar 29, 2017 at 6:21 AM, H. Hirzel <hannes.hirzel at gmail.com> wrote:

> What is the difference to the existing method ?
>
> center: centerPoint extent: extentPoint
>         "Answer an instance of me whose center is centerPoint and width
>         by height is extentPoint.  "
>
>         ^self origin: centerPoint - (extentPoint//2) extent: extentPoint
>
> Is / vs // worth the effort?
>
> On Wed, 29 Mar 2017 00:18:24 0000, commits at source.squeak.org
> <commits at source.squeak.org> wrote:
> > A new version of Graphics was added to project The Inbox:
> > http://source.squeak.org/inbox/Graphics-cbc.372.mcz
> >
> > ==================== Summary ====================
> >
> > Name: Graphics-cbc.372
> > Author: cbc
> > Time: 28 March 2017, 5:18:09.019402 pm
> > UUID: 7b9783b1-87c5-3549-ac32-42acd6abcb12
> > Ancestors: Graphics-eem.371
> >
> > Added method to allow creating a rectangle based on teh center of the
> > rectangle.
> >
> > =============== Diff against Graphics-eem.371 ===============
> >
> > Item was added:
> > + ----- Method: Rectangle class>>exactCenter:extent: (in category
> 'instance
> > creation') -----
> > + exactCenter: centerPoint extent: extentPoint
> > +     "Answer an instance of me whose center is centerPoint and width
> > +     by height is extentPoint. "
> > +     ^ self origin: centerPoint - (extentPoint / 2) extent: extentPoint
> > + !
> >
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20170329/822a9dea/attachment.html>


More information about the Squeak-dev mailing list