'From etoys2.2 of 1 October 2007 [latest update: #1744] on 2 November 2007 at 12:49:47 pm'! "Change Set: HandleResize-kfr-yo Date: 2 November 2007 Author: Karl Ramberg and Yoshiki Ohshima Adjust the handle size of Jerome's StarMorph and others."! !HandleMorph methodsFor: 'initialization' stamp: 'kfr 10/13/2007 13:57'! initialize "initialize the state of the receiver" super initialize. "" self extent: 16 @ 16. ! ! !StarMorph methodsFor: 'editing' stamp: 'yo 11/2/2007 12:45'! withCenterOuterHandles "Add to our handles the center positioning and outer resizing handles. Outer handle must not be blocked so it comes first. The editing routine expects to find the center handle second. The side and shape changing handles follow these." | center v1 hExtent holder | center := vertices average rounded. hExtent := 16 @ 16. v1 := vertices first. holder := {(EllipseMorph newBounds: (Rectangle center: v1 extent: hExtent) color: Color yellow) setBalloonText: 'Move me to adjust size. Shift move to adjust pointiness'. (EllipseMorph newBounds: (Rectangle center: center extent: hExtent) color: Color yellow) setBalloonText: 'Move me to adjust position'}. holder with: {#outside. #center} do: [:handle :which | handle on: #mouseDown send: #dragVertex:event:fromHandle: to: self withValue: which; on: #mouseMove send: #dragVertex:event:fromHandle: to: self withValue: which]. handles addAll: holder! ! !StarMorph methodsFor: 'editing' stamp: 'yo 11/2/2007 12:39'! withUpDownLeftRightHandlesAround: radius center: center "Add to our handles the side and shape changing handles." | tri above holder triAbove triBelow triRight triLeft | above := 0 @ radius negated. tri := Array with: 0 @ -10 with: 8 @ 6 with: -8 @ 6. triAbove := tri + (center + above). triBelow := triAbove collect: [:pt | pt rotateBy: #pi centerAt: center]. triRight := triAbove collect: [:pt | pt rotateBy: #right centerAt: center]. triLeft := triAbove collect: [:pt | pt rotateBy: #left centerAt: center]. holder := { (PolygonMorph vertices: triAbove color: Color green borderWidth: 1 borderColor: Color black) setBalloonText: 'More points.'. (PolygonMorph vertices: triBelow color: Color magenta borderWidth: 1 borderColor: Color black) setBalloonText: 'Fewer points.'. (PolygonMorph vertices: triRight color: Color green borderWidth: 1 borderColor: Color black) setBalloonText: 'Twinkle fatter.'. (PolygonMorph vertices: triLeft color: Color magenta borderWidth: 1 borderColor: Color black) setBalloonText: 'Twinkle thinner.'}. holder with: {#more. #less. #next. #prev} do: [:handle :which | handle on: #mouseDown send: #changeVertices:event:fromHandle: to: self withValue: which; on: #mouseMove send: #changeVertices:event:fromHandle: to: self withValue: which]. ^ handles addAll: holder! !