[Pharo-dev] Coordinates problem with Athens and Morphic while coding Hyperion

Benjamin Benjamin.VanRyseghem.Pharo at gmail.com
Thu Nov 28 04:54:35 EST 2013


Can you try to do something like

self changeProportionalLayout
before adding the morph ?

Ben

On 28 Nov 2013, at 10:51, kilon alios <kilon.alios at gmail.com> wrote:

> So I have found some strange problems with my vector editor , Hyperion. 
> 
> Hyperion is a Morph openInWindow. Code can be found in the class side of Hyperion>>open.
> 
>  The coordinate system when detecting events (mouseOver, mouseUp and mouseDown events of the Hyperion instance) looks like it takes to account also beyond the morph as coordinates as a result events happening at the top right edge of the morph where Hyperion is rendered is 6 at 30( which is the size of the window's title bar plus its borders). Thats ok, I have taken these offsets to account when computing the position of the mouse. I guess it uses the global coordinated and not the local coordinates of the morph. 
> 
> I am adding a button to control the edit mode of a line, when in edit mode handles for line's control points are shown and those handles can be dragged around to control the shape of the line , when off edit mode, the line will be able to be drag around (not implemented yet). 
> 
> My problem is that when I add that button as morph to the existing morph of Hyperion in 0 at 0 , it actually appears in 0 at 30 in local coordinated of the Hyperion moprh which in global coordinates it 6 at 60 ( 0 at 0 + 6 at 30 + 0 at 30 = 6 at 60). Why is that ?
> 
> I have no clue why I am getting an offset of 0 at 30 in local coordinates of the Hyperion morph.
> 
> here is the picture showing a) how it looks like b) the code that set the position c) transcript showing mouse coordinates when clicked in the top left corner of Hyperion morph
>  Hyperion coordinates problem.JPG
>  
> if anyone wants to try the code himself the repo is here
> 
> http://www.smalltalkhub.com/#!/~kilon/Hyperion
> 
> To sum up, to place that button on top left, I will have to position it 0@(-30) which for me makes no sense at all. 
> 
> Please note that everything is rendered with Athens.
> 
> Maybe I have messed up the code myself somewhere but I have looked it again and again I cant find a problem with my code.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20131128/d77903e6/attachment-0002.html>


More information about the Pharo-dev mailing list