World to Morph Local Co-ordinates
I'm sure this must be addressed somewhere, but searching the archives for "morph local point" didn't produce anything helpful⦠I have a PasteUpMorph that represents a scaled down world. So when a morph sets its position to e.g. 0@0, I want to set it to the topLeft corner of the pasteUp. I can use align:with:, but I thought some of the following might have some usefulness, but all returned 0@0. None of them have tests... screen globalPointToLocal: (0@0). screen localPointToGlobal: (0@0). screen pointInWorld: (0@0). screen referencePositionInWorld: (0@0). screen point: 0@0 from: screen. Is there an easy built-in way to convert points from World to the bounds of another (assume rectangular) morph? Thanks. ----- Cheers, Sean -- View this message in context: http://forum.world.st/World-to-Morph-Local-Co-ordinates-tp4735247.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
On 8 January 2014 19:54, Sean P. DeNigris <sean@clipperadams.com> wrote:
I'm sure this must be addressed somewhere, but searching the archives for "morph local point" didn't produce anything helpfulâ¦
I have a PasteUpMorph that represents a scaled down world. So when a morph sets its position to e.g. 0@0, I want to set it to the topLeft corner of the pasteUp. I can use align:with:, but I thought some of the following might have some usefulness, but all returned 0@0. None of them have tests... screen globalPointToLocal: (0@0). screen localPointToGlobal: (0@0). screen pointInWorld: (0@0). screen referencePositionInWorld: (0@0). screen point: 0@0 from: screen.
perhaps if you pick some morph, which (sub)chile of some TransformMorph, you will be able to see the difference. but for screen/world zero is always zero, because there is no difference between local and global , since its transformation is identity :)
Is there an easy built-in way to convert points from World to the bounds of another (assume rectangular) morph?
piece of cake, since all morphs use same, global coordinates, simple subtraction works:
localpoint := globalpoint - morph topLeft
Thanks.
----- Cheers, Sean -- View this message in context: http://forum.world.st/World-to-Morph-Local-Co-ordinates-tp4735247.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
-- Best regards, Igor Stasenko.
Maybe this thread gives some pointer: http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/2013-September/... I tend to call this a bug - at least it's not the expected behavior of embedded morphs IMO. Markus
Markus Schlager-2 wrote
http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/2013-September/...
Interesting thread - thanks! ----- Cheers, Sean -- View this message in context: http://forum.world.st/World-to-Morph-Local-Co-ordinates-tp4735247p4735265.ht... Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
participants (3)
-
Igor Stasenko -
Markus Schlager -
Sean P. DeNigris