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

H. Hirzel hannes.hirzel at gmail.com
Wed Mar 29 15:45:22 UTC 2017


Hi Chris,

On 3/29/17, Chris Cunningham <cunningham.cb at gmail.com> wrote:
> 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.

In the context of pixel based Rectangles it makes no sense.

If we talk about measurements in inches and centimeters than it is
fine. But the class Rectangle is not about that.


> 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.

I prefer this. Actually I need such a class as well. At the moment I
work with RectangleMorph.


> 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.

I do not understand how this change helps you with that ....

--Hannes

> -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
>> > + !
>> >
>> >
>> >
>>
>>
>


More information about the Squeak-dev mailing list