'From Squeak3.2alpha of 2 October 2001 [latest update: #4554] on 28 November 2001 at 7:07:40 pm'! "Change Set: FixPolygonScale Date: 28 November 2001 Author: Dan Ingalls Polygons and related shapes (Curves, Stars) do not need a flex shell to change their size and rotate. However, the Player logic that controls scaling and rotation expects a flex shell to be used. This caused walkbacks in the past, and has been worked around recently by no-oping these operations. This changeSet causes a flex shell to be used when players are involved, but continues the non-flexed control from the halos, owing to its better visual results and consistency with constant border widths when resizing, eg, ellipses and rectangles from the halo. "! !Morph methodsFor: 'rotate scale and flex' stamp: 'di 11/28/2001 18:22'! addFlexShellIfNecessary "If this morph requires a flex shell to scale or rotate, then wrap it in one and return it. Polygons, eg, may override to return themselves." ^ self addFlexShell! ! !HaloMorph methodsFor: 'private' stamp: 'di 11/28/2001 18:25'! startRot: evt with: rotHandle "Initialize rotation of my target if it is rotatable. Launch a command object to represent the action" self obtainHaloForEvent: evt andRemoveAllHandlesBut: rotHandle. target isFlexMorph ifFalse: [target isInWorld ifFalse: [self setTarget: target player costume]. target addFlexShellIfNecessary]. growingOrRotating _ true. self removeAllHandlesBut: rotHandle. "remove all other handles" angleOffset _ evt cursorPoint - (target pointInWorld: target referencePosition). angleOffset _ Point r: angleOffset r degrees: angleOffset degrees - target rotationDegrees. self setProperty: #commandInProgress toValue: (Command new cmdWording: 'rotating'; undoTarget: target selector: #rotationDegrees: argument: target rotationDegrees) ! ! !HaloMorph methodsFor: 'private' stamp: 'di 11/28/2001 18:25'! startScale: evt with: scaleHandle "Initialize scaling of my target." self obtainHaloForEvent: evt andRemoveAllHandlesBut: scaleHandle. target isFlexMorph ifFalse: [target addFlexShellIfNecessary]. growingOrRotating _ true. positionOffset _ 0@0 ! ! !Player methodsFor: 'slot getters/setters' stamp: 'di 11/28/2001 18:29'! setScaleFactor: aNumber "Set the scale factor to be the given value" | aCostume | aCostume _ self costume. 1.0 = aNumber ifTrue: [0.0 = self getHeading ifTrue: [aCostume isFlexMorph ifTrue: [aCostume removeFlexShell]. ^ self]] ifFalse: [aCostume isFlexMorph ifFalse: [aCostume addFlexShell]]. costume scale: (aNumber asFloat max: 0.125)! ! !PolygonMorph methodsFor: 'halo control' stamp: 'di 11/28/2001 18:23'! addFlexShellIfNecessary "When scaling or rotating from a halo, I can do this without a flex shell" ^ self ! ! PolygonMorph removeSelector: #addFlexShell!