#referencePostion returns the specified center for the morph in global coordinates.
By default this will be the same as ���self bounds origin + (self bounds extent/2.0)��� but can have other depending on what #rotationCenter
returns.
#referencePositon: on the other hand do not set a new centre, but moves the morph to a new position by using the referencePosition
as origin instead of its top left corner.
Example:
| m |
m := Morph new
color: Color orange;
extent: 200@72;
openCenteredInWorld;
yourself.
m on: #click send: #value to: [ m referencePosition: (m referencePosition + (10@10)) ] .
Looking at Morph>>#handleDropMorph: referencePosition is used to place the dropped morph in centre of the new owner.
���
observation:
���(self transformedFrom: anEvent hand world) globalPointToLocal: aMorph referencePosition��� looks incomplete as it will always be equal
to just doing ���aMorph referencePosition��� because #transformedFrom: always returns an IdentityTransform where # globalPointToLocal: just returns the point given to it.
���
Best regards,
Henrik
From: Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org]
On Behalf Of Aliaksei Syrel
Sent: Wednesday, January 27, 2016 4:12 PM
To: Pharo Development List <pharo-dev@lists.pharo.org>
Subject: [Pharo-dev] Morphic magician requested. What is referencePosition?
Hi
Do anyone know what is Morph>>#referencePosition and why is it used to handle drag and drop?
Here is what method doc says:
"Return the current reference position of the receiver"
Thanks,
Alex