[squeak-dev] The Trunk: Morphic-mt.1426.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri May 4 06:49:34 UTC 2018
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1426.mcz
==================== Summary ====================
Name: Morphic-mt.1426
Author: mt
Time: 4 May 2018, 8:49:10.20407 am
UUID: 1f2d43f7-f891-4a45-a18c-306ae6fa4094
Ancestors: Morphic-mt.1425
Minor fix to reset mouse cursor for drag-drop operations. Got annoying because of the text cursor in workspaces. Try: "Morph new openInHand".
Needs further clean-up because #attachMorph:, #grabMorph:, and #grabMorph:from: exhibit much code duplication.
=============== Diff against Morphic-mt.1425 ===============
Item was changed:
----- Method: HandMorph>>attachMorph: (in category 'grabbing/dropping') -----
attachMorph: m
"Position the center of the given morph under this hand, then grab it.
This method is used to grab far away or newly created morphs."
| delta |
self releaseMouseFocus. "Break focus"
+ self showTemporaryCursor: nil.
delta := m bounds extent // 2.
m position: (self position - delta).
m formerPosition: m position.
targetOffset := m position - self position.
self addMorphBack: m.!
Item was changed:
----- Method: HandMorph>>grabMorph: (in category 'meta-actions') -----
grabMorph: aMorph
"Grab the given morph (i.e., add it to this hand and remove it from its current owner) without changing its position. This is used to pick up a morph under the hand's current position, versus attachMorph: which is used to pick up a morph that may not be near this hand."
| grabbed |
self releaseMouseFocus. "Break focus"
+ self showTemporaryCursor: nil.
grabbed := aMorph aboutToBeGrabbedBy: self.
grabbed ifNil:[^self].
grabbed := grabbed topRendererOrSelf.
^self grabMorph: grabbed from: grabbed owner!
Item was changed:
----- Method: HandMorph>>grabMorph:from: (in category 'grabbing/dropping') -----
grabMorph: aMorph from: formerOwner
"Grab the given morph (i.e., add it to this hand and remove it from its current owner) without changing its position. This is used to pick up a morph under the hand's current position, versus attachMorph: which is used to pick up a morph that may not be near this hand."
| grabbed offset targetPoint grabTransform fullTransform |
self releaseMouseFocus. "Break focus"
+ self showTemporaryCursor: nil.
grabbed := aMorph.
aMorph keepsTransform ifTrue:[
grabTransform := fullTransform := IdentityTransform new.
] ifFalse:[
"Compute the transform to apply to the grabbed morph"
grabTransform := formerOwner
ifNil: [IdentityTransform new]
ifNotNil: [formerOwner grabTransform].
"Compute the full transform for the grabbed morph"
fullTransform := formerOwner
ifNil: [IdentityTransform new]
ifNotNil: [formerOwner transformFrom: owner].
].
"targetPoint is point in aMorphs reference frame"
targetPoint := fullTransform globalPointToLocal: self position.
"but current position will be determined by grabTransform, so compute offset"
offset := targetPoint - (grabTransform globalPointToLocal: self position).
"apply the transform that should be used after grabbing"
grabbed := grabbed transformedBy: grabTransform.
grabbed == aMorph
ifFalse: [grabbed setProperty: #addedFlexAtGrab toValue: true].
"offset target to compensate for differences in transforms"
grabbed position: grabbed position - offset asIntegerPoint.
"And compute distance from hand's position"
targetOffset := grabbed position - self position.
self addMorphBack: grabbed.
grabbed justGrabbedFrom: formerOwner.!
More information about the Squeak-dev
mailing list
|