[squeak-dev] The Trunk: Morphic-mt.1783.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Oct 7 13:17:04 UTC 2021
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1783.mcz
==================== Summary ====================
Name: Morphic-mt.1783
Author: mt
Time: 7 October 2021, 3:16:58.720277 pm
UUID: ccc05305-cb74-6841-8a74-ed5a772f7b4b
Ancestors: Morphic-mt.1782
Revises Morphic-mt.1781. Only be a renderer if you have a single submorph. Now you can open a halo on the items in a tree morph again.
Also fixes meta-click+drag bug on morphs that have a flex-shell.
Also fixes change-hierarchy bug on morphs that have a flex-shell.
=============== Diff against Morphic-mt.1782 ===============
Item was changed:
----- Method: MorphicHaloDispatcher>>dispatchHalo:createFor: (in category 'dispatching') -----
dispatchHalo: anEvent createFor: aContainer
"Invoke a halo on any aContainer's submorph that wants it. Dispatch uses anEvent's #position. The dispatch only ends in that container if no other morph wants it. Note that the event's #shiftPressed state determines whether the dispatch goes innermost-to-outermost (if pressed) or the other way around (if not pressed).
If there already is a halo, check whether the event still points into the same hierarchy. If it does, do nothing here but rely on the halo itself to process the event (see implementors of #transferHalo:from:). If, however, the event points to a different hierarchy in the container, invoke a new halo and discard the current one. We do this here because the current halo should not bother with its container but only its #target."
| stack innermost haloTarget |
"The stack is the frontmost (i.e. innermost) to backmost (i.e. outermost) morph."
stack := (aContainer morphsAt: anEvent position unlocked: true) select:
+ [ : each | each wantsHaloFromClick or: [ each isRenderer ] ].
- [ : each | each wantsHaloFromClick ].
"self assert: [ stack last == aContainer ]."
innermost := anEvent hand halo
ifNil: [ stack first ]
ifNotNil:
[ : existingHalo |
"self assert: [ existingHalo wantsHaloFromClick not ]. "
stack
detect: [ : each | each owner == aContainer ]
ifFound:
[ : topInContainer | "Is existingHalo's target part of the same topInContainer as the morph clicked?"
(existingHalo target withAllOwners includes: topInContainer)
ifTrue: [ "same hierarchy, let #transferHalo: continue to handle it for now." ^ false ]
ifFalse:
[ "different hierarchy, remove + add."
anEvent hand removeHalo.
anEvent shiftPressed
ifTrue: [ stack first ]
ifFalse: [ topInContainer ] ] ]
ifNone: [ "existingHalo is on the World, defer to #transferHalo: for now." ^ false ] ].
"If modifier key is pressed, start at innermost (the target), otherwise the outermost (direct child of the world (self))."
haloTarget := (innermost == aContainer or: [ anEvent shiftPressed ])
ifTrue: [ innermost ]
ifFalse:
[ "Find the outermost owner that wants it. Ignore containment above aContainer."
stack := innermost withAllOwners.
(stack first: (stack findFirst: [ : each | each owner == aContainer ])) reversed
+ detect: [ : each | each wantsHaloFromClick or: [ each isRenderer ] ]
- detect: [ : each | each wantsHaloFromClick ]
ifNone: [ "haloTarget has its own mouseDown handler, don't halo." ^ false ] ].
"Now that we have the haloTarget, show the halo."
self invokeHaloOrMove: anEvent on: haloTarget.
^ true!
Item was changed:
----- Method: MorphicHaloDispatcher>>invokeHaloOrMove:on: (in category 'invoking') -----
invokeHaloOrMove: anEvent on: aMorph
"Special gestures (cmd-mouse on the Macintosh; Alt-mouse on Windows and Unix) allow a mouse-sensitive morph to be moved or bring up a halo for the morph."
+ | h doNotDrag |
- | h tfm doNotDrag |
anEvent hand newMouseFocus: aMorph event: anEvent.
h := anEvent hand halo.
"Prevent wrap around halo transfers originating from throwing the event back in"
doNotDrag := false.
h ifNotNil:[
(h innerTarget == aMorph) ifTrue:[doNotDrag := true].
(h innerTarget hasOwner: aMorph) ifTrue:[doNotDrag := true].
(aMorph hasOwner: h target) ifTrue:[doNotDrag := true]].
+ h := aMorph addHalo: anEvent.
- tfm := (aMorph transformedFrom: nil) inverseTransformation.
-
- "cmd-drag on flexed morphs works better this way"
- h := aMorph addHalo: (anEvent transformedBy: tfm).
h setProperty: #lastHaloDispatcher toValue: self.
doNotDrag ifTrue:[^ true].
"Initiate drag transition if requested"
anEvent hand
waitForClicksOrDrag: h
+ event: anEvent
- event: (anEvent transformedBy: tfm)
selectors: { nil. nil. nil. #startDragTarget:. }
threshold: HandMorph dragThreshold.
"Pass focus explicitly here"
anEvent hand newMouseFocus: h.
"Reset temporary cursors to make available halo interaction visible."
anEvent hand showTemporaryCursor: nil.
^ true!
Item was changed:
----- Method: TransformMorph>>isRenderer (in category 'classification') -----
isRenderer
+ ^ submorphs size = 1
- ^ true
!
Item was changed:
----- Method: TransformMorph>>morphicLayerNumber (in category 'submorphs - layers') -----
morphicLayerNumber
+ ^ self isRenderer
+ ifTrue: [self renderedMorph morphicLayerNumber]
- ^ self hasSubmorphs
ifFalse: [super morphicLayerNumber]
+ !
- ifTrue: [self firstSubmorph morphicLayerNumber]!
Item was changed:
----- Method: TransformMorph>>renderedMorph (in category 'classification') -----
renderedMorph
"We are a renderer. Answer appropriately."
+ ^ self isRenderer
- ^ self hasSubmorphs
ifTrue: [self firstSubmorph renderedMorph]
+ ifFalse: [super renderedMorph]!
- ifFalse: [self]!
Item was changed:
----- Method: TransformMorph>>wantsHaloFromClick (in category 'halos and balloon help') -----
wantsHaloFromClick
+ ^ self hasSubmorphs not!
- ^ self renderedMorph == self!
More information about the Squeak-dev
mailing list
|