tim Rowledge uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-tpr.1058.mcz==================== Summary ====================
Name: Morphic-tpr.1058
Author: tpr
Time: 8 December 2015, 6:45:23.463 pm
UUID: c438744a-71c4-45a0-ade8-7ecf52f50f89
Ancestors: Morphic-cwp.1057, Morphic-tpr.1057
Transfer from inbox, keep up to date.
=============== Diff against Morphic-cwp.1057 ===============
Item was added:
+ ----- Method: HandMorph>>gridPointRaw (in category 'gridded cursor') -----
+ gridPointRaw
+ "return my latest position gridded"
+ ^self griddedPoint: self currentEvent position!
Item was added:
+ ----- Method: HandMorph>>gridTo:origin: (in category 'gridded cursor') -----
+ gridTo: grid origin: offset
+ "set a couple of properties to specify gridding for the temporaryCursor; instvars would be nicer"
+ self setProperty: #gridStep toValue: grid;
+ setProperty: #gridOffset toValue: offset!
Item was added:
+ ----- Method: HandMorph>>griddedPoint: (in category 'gridded cursor') -----
+ griddedPoint: aPoint
+ "return the equivalent point snapped to the grid, if indeed any gridding is set"
+ self valueOfProperty: #gridStep ifPresentDo: [:grid| |offset|
+ offset := self valueOfProperty: #gridOffset ifAbsent: [0@0].
+ ^ offset + (aPoint + (grid //2) - offset truncateTo: grid)].
+ ^aPoint!
Item was changed:
----- Method: HandMorph>>position: (in category 'geometry') -----
position: aPoint
"Overridden to align submorph origins to the grid if gridding is on."
| adjustedPosition delta box |
adjustedPosition := aPoint.
+ temporaryCursor ifNotNil: [adjustedPosition := (self griddedPoint: adjustedPosition) + temporaryCursorOffset].
- temporaryCursor ifNotNil: [adjustedPosition := adjustedPosition + temporaryCursorOffset].
"Copied from Morph to avoid owner layoutChanged"
"Change the position of this morph and and all of its submorphs."
delta := adjustedPosition - bounds topLeft.
delta isZero ifTrue: [^ self]. "Null change"
box := self fullBounds.
(delta dotProduct: delta) > 100 ifTrue:[
"e.g., more than 10 pixels moved"
self invalidRect: box.
self invalidRect: (box translateBy: delta).
] ifFalse:[
self invalidRect: (box merge: (box translateBy: delta)).
].
self privateFullMoveBy: delta.
!
Item was added:
+ ----- Method: HandMorph>>turnOffGridding (in category 'gridded cursor') -----
+ turnOffGridding
+ "remove the gridding properties to stop gridding"
+ self removeProperty: #gridStep; removeProperty: #gridOffset!