rotating a morph through messaging

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

rotating a morph through messaging

Steve Quezadas-3
I am experimenting with pharo right now, particularly with Morphs. The
weird thing is that some morphs can have a rotation halo and others do not.

This has a "rotate halo":
bar := EllipseMorph new.
bar openInWorld.

This does not:
foo := Morph new.
foo openInWorld

Am I missing something? Also, how do I send message "rotate" to a morph?
I can't seem to find a "rotate" method anywhere in the browser.

- Steve

Reply | Threaded
Open this post in threaded view
|

Re: rotating a morph through messaging

Ben Coman


On Mon, 31 Dec 2018 at 04:24, Steve Quezadas <[hidden email]> wrote:

>
> I am experimenting with pharo right now, particularly with Morphs. The
> weird thing is that some morphs can have a rotation halo and others do not.
>
> This has a "rotate halo":
> bar := EllipseMorph new.
> bar openInWorld.
>
> This does not:
> foo := Morph new.
> foo openInWorld
>
> Am I missing something? Also, how do I send message "rotate" to a morph?
> I can't seem to find a "rotate" method anywhere in the browser.

I don't know anything about this area, but here is how I discovered something to get you started... 
(somewhat recursively...) open new halos on the ellipse-rotation-halo,
then click the spanner halo to Debug > Inspect Morph.
To confirm you are in the right place confirm you can see...  
    owner ==> HaloMorph.
    extension > balloonText ==> 'Rotate'
Now dive into... extension > eventHandler > subscriptions, and you'll see a Dictionary with three items...
  #mouseDown > Items > aMorphEventSubscription > selector ==> #startRot:with:
  #mouseMove > Items > aMorphEventSubscription > selector ==> #doRot:with:
  #mouseUp   > Items > aMorphEventSubscription > selector ==> #endInteraction

HTH,
cheers -ben
Reply | Threaded
Open this post in threaded view
|

Re: rotating a morph through messaging

K K Subbu
In reply to this post by Steve Quezadas-3
On 31/12/18 1:54 AM, Steve Quezadas wrote:

> I am experimenting with pharo right now, particularly with Morphs. The
> weird thing is that some morphs can have a rotation halo and others do not.
>
> This has a "rotate halo":
> bar := EllipseMorph new.
> bar openInWorld.
>
> This does not:
> foo := Morph new.
> foo openInWorld

A morph has to implement #prepareToRotate method for rotate Halo button
to appear and also implement rotationDegrees: method to do the actual
transformation. Otherwise, you can add a flex shell to the morph and
request it to rotate it.

Morph does not support rotation, so there is no rotation button in its
halo. EllipseMorph has a dummy rotationDegrees: method. CircleMorph and
PolygonMorph go the whole way.

foo := Morph new addFlexShell openCenteredInWorld
foo topRendererOrSelf rotationDegrees: 45

bar := (PolygonMorph
                vertices: {261@400. 388@519. 302@595}
                color: Color blue
                borderWidth: 2
                borderColor: Color black) openInWorld.
bar rotationDegrees: 45

HTH .. Subbu