[ENH] Improved morph drop
Sean McGrath
sean at rosewood.his.ucsf.edu
Wed May 17 22:20:47 UTC 2000
Here is a change (to HandMorph dropTargetFor:event:) that uses the center
of the dragged morph instead of the cursor position to find the target of
a drop. When dropping morphs, it works better because system behaviour
matches visual expectation when the cursor is near the edge of the morph
you are dropping.
'From Squeak2.8alpha of 23 March 2000 [latest update: #2158] on 17 May
2000 at 3:09:37 pm'!
!HandMorph methodsFor: 'grabbing/dropping' stamp: 'sm 5/17/2000 09:21'!
dropTargetFor: aMorph event: evt
"Return the morph that the given morph is to be dropped
onto. Return nil if we must repel the morph.
Return the world, if no other morph wants the dropping morph."
| root coreSample |
aMorph willingToBeEmbeddedUponLanding ifFalse: [^ self world].
root _ nil.
owner
submorphsReverseDo: [:m | ((m fullContainsPoint: aMorph center)
and: [(m isKindOf: HaloMorph) not])
ifTrue: [root _ m]].
root == nil ifTrue: [^ self world].
coreSample _ root morphsAt: aMorph center.
coreSample do: [:m | (m repelsMorph: aMorph event: evt)
ifTrue: [^ nil]].
coreSample do: [:m | (m wantsDroppedMorph: aMorph event: evt)
ifTrue: [^ m]].
^ self world! !
More information about the Squeak-dev
mailing list
|