[squeak-dev] The Trunk: Morphic-mt.1740.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Mar 11 13:12:06 UTC 2021


Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1740.mcz

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

Name: Morphic-mt.1740
Author: mt
Time: 11 March 2021, 2:11:59.965436 pm
UUID: 3512b5b2-7e73-134e-ae42-dfedc359858f
Ancestors: Morphic-mt.1739

Minor clean-up in initial halo dispatch:
- Do not ask for #handlesMouseDown: but only #wantsHaloFromClick. 
- Do not rely on aContainer being the actual world (e.g. aPasteUp) but maybe any (inner) container.
- Leave two assertions as documentation.

Effective rules for halo dispatch not changed. The bug with protruding submorphs is still present.

=============== Diff against Morphic-mt.1739 ===============

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."
- dispatchHalo: anEvent createFor: aMorph
- 	"Invoke halos around the top-most world container at aUserInputEvent's #position.  If it was already halo'd, zero-in on its next inward component morph at that position.  Holding Shift during the click reverses this traversal order."
  
  	| 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 ].
+ 	"self assert: [ stack last == aContainer ]."
- 	"the stack is the top-most morph to bottom-most."
- 	stack := (aMorph morphsAt: anEvent position unlocked: true) select:
- 		[ : each | each wantsHaloFromClick or: [ each handlesMouseDown: anEvent ] ].
  	innermost := anEvent hand halo
  		ifNil: [ stack first ]
  		ifNotNil:
+ 			[ : existingHalo |
+ 			"self assert: [ existingHalo wantsHaloFromClick not ]. "
+ 			stack
+ 				detect: [ : each | each owner == aContainer ]
- 			[ : existingHalo | 
- 			(stack := stack copyWithout: existingHalo) "No halos on halos"
- 				detect: [ : each | each owner == aMorph ]
  				ifFound:
+ 					[ : topInContainer | "Is existingHalo's target part of the same topInContainer as the morph clicked?"
+ 					(existingHalo target withAllOwners includes: topInContainer)
- 					[ : worldContainer | "Is existingHalo's target part of the same worldContainer as the morph clicked?"
- 					(existingHalo target withAllOwners includes: worldContainer)
  						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 ] ] ]
- 								ifFalse: [ worldContainer ] ] ]
  				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 ])
- 	haloTarget := (innermost == aMorph 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
- 			 [ "Find the outermost owner that wants it."
- 			innermost withAllOwners reversed allButFirst
  				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!



More information about the Squeak-dev mailing list