[squeak-dev] The Trunk: Morphic-cbc.1450.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Jun 13 04:49:33 UTC 2018


Chris Cunningham uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-cbc.1450.mcz

==================== Summary ====================

Name: Morphic-cbc.1450
Author: cbc
Time: 12 June 2018, 9:49:08.273851 pm
UUID: 85dec3fe-462d-7242-bdb4-797746d320a0
Ancestors: Morphic-dtl.1449

Recategorized rotationCenter and referencePosition (and setter versions) to more a more appropriate category.
rotationCenter is the relative position of the referencePosition point within the morph.  They are related - and should live together.
Also, moved base Morph versions of these out of EToys to be with the others.

=============== Diff against Morphic-dtl.1449 ===============

Item was changed:
+ ----- Method: CircleMorph>>referencePosition (in category 'rotate scale and flex') -----
- ----- Method: CircleMorph>>referencePosition (in category 'geometry eToy') -----
  referencePosition 
  	"Return the current reference position of the receiver"
  	^ self valueOfProperty: #referencePosition ifAbsent: [ self center ]
  !

Item was changed:
+ ----- Method: CircleMorph>>rotationCenter (in category 'rotate scale and flex') -----
- ----- Method: CircleMorph>>rotationCenter (in category 'geometry eToy') -----
  rotationCenter
  	"Return the rotation center of the receiver. The rotation center defines the relative offset inside the receiver's bounds for locating the reference position."
  	| refPos |
  	refPos := self referencePosition.
  	^ (refPos - self bounds origin) / self bounds extent asFloatPoint!

Item was changed:
+ ----- Method: CircleMorph>>rotationCenter: (in category 'rotate scale and flex') -----
- ----- Method: CircleMorph>>rotationCenter: (in category 'geometry eToy') -----
  rotationCenter: aPointOrNil
  	"Set the new rotation center of the receiver. The rotation center defines the relative offset inside the receiver's bounds for locating the reference position."
  	| newRef box |
  	aPointOrNil isNil
  		ifTrue: [self removeProperty: #referencePosition.
  			self removeProperty: #originalCenter.
  			self removeProperty: #originalAngle. ]
  		ifFalse: [ box := self bounds.
  				newRef := box origin + (aPointOrNil * box extent).
  				self setRotationCenterFrom: newRef ].
  
  !

Item was changed:
+ ----- Method: MatrixTransformMorph>>rotationCenter (in category 'rotate scale and flex') -----
- ----- Method: MatrixTransformMorph>>rotationCenter (in category 'geometry eToy') -----
  rotationCenter
  	| pt |
  	pt := self transform localPointToGlobal: super rotationCenter.
  	^pt - bounds origin / bounds extent asFloatPoint!

Item was changed:
+ ----- Method: MatrixTransformMorph>>rotationCenter: (in category 'rotate scale and flex') -----
- ----- Method: MatrixTransformMorph>>rotationCenter: (in category 'geometry eToy') -----
  rotationCenter: aPoint
  	super rotationCenter: (self transform globalPointToLocal: bounds origin + (bounds extent * aPoint))!

Item was added:
+ ----- Method: Morph>>referencePosition (in category 'rotate scale and flex') -----
+ referencePosition
+ 	"Return the current reference position of the receiver"
+ 	| box |
+ 	box := self bounds.
+ 	^box origin + (self rotationCenter * box extent).
+ !

Item was added:
+ ----- Method: Morph>>referencePosition: (in category 'rotate scale and flex') -----
+ referencePosition: aPosition
+ 	"Move the receiver to match its reference position with aPosition"
+ 	| newPos intPos |
+ 	newPos := self position + (aPosition - self referencePosition).
+ 	intPos := newPos asIntegerPoint.
+ 	newPos = intPos 
+ 		ifTrue:[self position: intPos]
+ 		ifFalse:[self position: newPos].!

Item was changed:
+ ----- Method: Morph>>rotationCenter (in category 'rotate scale and flex') -----
- ----- Method: Morph>>rotationCenter (in category 'geometry eToy') -----
  rotationCenter
  	"Return the rotation center of the receiver. The rotation center defines the relative offset inside the receiver's bounds for locating the reference position."
  	^self valueOfProperty: #rotationCenter ifAbsent:[0.5 at 0.5]
  !

Item was changed:
+ ----- Method: Morph>>rotationCenter: (in category 'rotate scale and flex') -----
- ----- Method: Morph>>rotationCenter: (in category 'geometry eToy') -----
  rotationCenter: aPointOrNil
  	"Set the new rotation center of the receiver. The rotation center defines the relative offset inside the receiver's bounds for locating the reference position."
  	aPointOrNil isNil
  		ifTrue:[self removeProperty: #rotationCenter]
  		ifFalse:[self setProperty: #rotationCenter toValue: aPointOrNil]
  !

Item was changed:
+ ----- Method: PolygonMorph>>referencePosition (in category 'rotate scale and flex') -----
- ----- Method: PolygonMorph>>referencePosition (in category 'geometry eToy') -----
  referencePosition 
  	"Return the current reference position of the receiver"
  	^ self valueOfProperty: #referencePosition ifAbsent: [super referencePosition]
  !

Item was changed:
+ ----- Method: PolygonMorph>>rotationCenter (in category 'rotate scale and flex') -----
- ----- Method: PolygonMorph>>rotationCenter (in category 'geometry eToy') -----
  rotationCenter
  	"Return the rotation center of the receiver. The rotation center defines the relative offset inside the receiver's bounds for locating the reference position."
  	| refPos |
  	refPos := self valueOfProperty: #referencePosition
  		ifAbsent: [^ 0.5 at 0.5].
  	^ (refPos - self bounds origin) / self bounds extent asFloatPoint!

Item was changed:
+ ----- Method: PolygonMorph>>rotationCenter: (in category 'rotate scale and flex') -----
- ----- Method: PolygonMorph>>rotationCenter: (in category 'geometry eToy') -----
  rotationCenter: aPointOrNil
  	"Set the new rotation center of the receiver. The rotation center defines the relative offset inside the receiver's bounds for locating the reference position."
  	| box |
  	aPointOrNil isNil
  		ifTrue: [self removeProperty: #referencePosition]
  		ifFalse: [box := self bounds.
  				self setProperty: #referencePosition
  					toValue: box origin + (aPointOrNil * box extent)]
  !

Item was changed:
+ ----- Method: TransformationMorph>>referencePosition (in category 'rotate scale and flex') -----
- ----- Method: TransformationMorph>>referencePosition (in category 'geometry eToy') -----
  referencePosition
  	"Answer the  receiver's reference position, bullet-proofed against infinite recursion in the unlikely but occasionally-seen case that I am my own renderee"
  
  	| rendered |
  	^ (rendered := self renderedMorph) == self
  		ifTrue:
  			[super referencePosition]
  		ifFalse:
  			[transform localPointToGlobal: rendered referencePosition]!



More information about the Squeak-dev mailing list