'From Moshi of 3 March 2007 [latest update: #1474] on 19 August 2010 at 2:35:32 am'!"Change Set:		LRotationHandler1-yoDate:			19 August 2010Author:			Yoshiki OhshimaA handler to rotate another object.  Try something like:ll := LesserphicMorph new.ll openInWorld.ll window add: (a := LBox new).b := LBox extent: 10@10 color: Color green.a position: 100@100.a shape texture: (LBox loadTexture: #asdf).b topRight: a topRight + (5@-5).(h := LRotationHandler new) installTo: b.h target: a.ll window addFirst: b."!LUserEventHandler subclass: #LRotationHandler	instanceVariableNames: 'clickPosition origDiff origAngle'	classVariableNames: ''	poolDictionaries: ''	category: 'LObjects'!!LBox methodsFor: 'geometry access' stamp: 'yo 8/19/2010 02:23'!pivotPosition	"The pivot point is the center of rotation of a box and the baseline for a letter.  Return the pivot point in the coordinates of the container (owner)."	^self globalPointFor: self pivotOffset.	"^ self pivotOffset + self translation"! !!LBox methodsFor: 'geometry access' stamp: 'yo 8/19/2010 02:33'!pivotPositionX: newX	"The pivot point is the center of rotation of a box and the baseline for a letter.  Move the box so that the pivot point's y is newY in the coordinates of the container (owner)."	self translation: ((newX - self pivotOffset x)@self translation y)"	self translateBy: (self localPointFor: (newX@0) x - self pivotOffset x)@0."! !!LBox methodsFor: 'geometry access' stamp: 'yo 8/19/2010 02:32'!pivotPositionY: newY	"The pivot point is the center of rotation of a box and the baseline for a letter.  Move the box so that the pivot point's y is newY in the coordinates of the container (owner)."	self translation: (self translation x@(newY - self pivotOffset y))."	self translateBy: 0@(self localPointFor: (0@newY) y - self pivotOffset y)."! !!LBox methodsFor: 'geometry access' stamp: 'yo 8/19/2010 02:01'!pivotPosition: aPoint	"Move this box so that the pivot point is at aPoint in the coordinates of this box's container.  The pivot point is the center of rotation of a box and the baseline for a letter.  "	self translateBy: (self localPointFor: aPoint) - self pivotOffset.! !!LRotationHandler methodsFor: 'all' stamp: 'yo 8/19/2010 02:33'!buttonDown: event with: anLObject	whole on: LMotionEvent to: self.	event hand focus: whole.	clickPosition := event localPointFor: whole.	origDiff := (target localPointFor: whole pivotPosition) - target pivotOffset.	origAngle := 	origDiff degrees degreesToRadians.	event handled: self.! !!LRotationHandler methodsFor: 'all' stamp: 'yo 8/19/2010 02:33'!buttonUp: event with: anLObject	whole unsubscribe: self for: LMotionEvent.	event hand focus: nil.	event handled: self.! !!LRotationHandler methodsFor: 'all' stamp: 'yo 8/18/2010 22:56'!listensTo	^ #(LButtonDownEvent LButtonUpEvent) asListensArray! !!LRotationHandler methodsFor: 'all' stamp: 'yo 8/19/2010 02:24'!motion: event with: anLObject	| diff rot |	diff := (target localPointFor: event position) - target pivotOffset.	rot := diff degrees degreesToRadians - origAngle.	target rotateBy: rot around: target pivotRatio.	whole rotateBy: rot.	whole pivotPosition: (target globalPointFor: (origDiff + target pivotOffset)).	event handled: self.! !!LRotationHandler reorganize!('worlds-accessors' wiv666clickPosition wiv666clickPosition: wiv666origAngle wiv666origAngle: wiv666origDiff wiv666origDiff:)('all' buttonDown:with: buttonUp:with: listensTo motion:with:)!