Avoid fraction:offset: it is a bad interface.
On Thu, Jun 22, 2017 at 7:20 AM, Stephane Ducasse
<stepharo.self@gmail.com> wrote:
> Welcome Trey
>
> This is nice. Did you see that we started long time ago to have a
> version of the original tutorial on github to port it to Pharo. Feel
> free to send pull requests.
>
> About this API. the old API was not good because it forced you to
> create a bogus rectangle often for nothing
> and also points for nothing.
> It is better to use the accessors to set the value since a layoutFrame
> is initialized first.
> Have a look at the users of LayoutFrame or asLayoutFrame.
> There is no raison to create a point 0@200 if you can just use the
> correct accessors to set 200.
>
> stef
>
>
>
> On Wed, Jun 21, 2017 at 12:10 AM, Trey Tomes <trey.tomes@gmail.com> wrote:
>> Hello!
>>
>> I'm new to this list, so I apologize if this topic has already been
>> considered.
>>
>> I have been re-creating the Laser Game tutorial in Pharo 6, and have
>> encountered something that may be an error within Pharo.
>>
>> The LayoutFrame has the ability to use negative values for the bottom and
>> right sides of the rectangle assigned to the offsets, e.g.
>>
>> LayoutFrame fraction: ((0@0 corner: (1@1)) offsets: ((4@4 corner: (-4@-4)).
>>
>> This is useful, as it allows the system to automatically calculate the
>> margins inset from the bottom and right sides of the container.
>>
>> In Pharo 6, this does not work.�� The setLeft:right:top:bottom: and
>> setPoint:point: messages both use the min: and max: messages to rearrange
>> the Rectangle so that the smallest numbers get pushed to the top and left.
>>
>> In order to get things to render correctly in my system, I had to change
>> these messages to look like this:
>>
>> setLeft: left right: right top: top bottom: bottom
>>�� �� ��self setPoint: (left@top) point: (right@bottom).
>>
>> setPoint: pt1 point: pt2
>>�� �� ��origin := pt1.
>>�� �� ��corner := pt2.
>>
>>
>> In place of this:
>>
>> setLeft: left right: right top: top bottom: bottom
>>�� �� ��origin := (left min: right) @ (top min: bottom).
>>�� �� ��corner := (left max: right) @ (top max: bottom).
>>
>> setPoint: pt1 point: pt2
>>�� �� ��origin := (pt1 x min: pt2 x) @ (pt1 y min: pt2 y).
>>�� �� ��corner := (pt1 x max: pt2 x) @ (pt1 y max: pt2 y).
>>
>>
>> I haven't found any bad side-effects to changing this yet, but is there a
>> reason the Rectangle class was changed?
>>
>> Thanks,
>> Trey