DragAndDropManager.st
changeset 4108 ac5dce7be176
parent 4006 a4dd0d13f91b
child 4124 e685cbc75d30
--- a/DragAndDropManager.st	Mon Jun 04 15:51:09 2018 +0200
+++ b/DragAndDropManager.st	Tue Jun 05 10:17:40 2018 +0200
@@ -17,7 +17,7 @@
 	instanceVariableNames:'dropContext dragView dropAction dragOffset handler restoreBlock
 		alienCursor enabledCursor disabledCursor canDrop escapePressed
 		passiveAction autoScrollTask disabledFlag giveFocusToTargetWidget
-		notifyEndOfDropAction savedCursor'
+		notifyEndOfDropAction savedCursor lastTopView'
 	classVariableNames:'DragContextQuerySignal DragOriginatorQuerySignal
 		DragOffsetQuerySignal ActiveDragAndDropManagers'
 	poolDictionaries:''
@@ -1223,7 +1223,7 @@
 
 buttonMotion:buttonAndModifierState x:x y:y view:aView
     |device screenPoint oldWidget oldId oldPoint newId newWidget oldTarget newTarget 
-     isDroppable cursor|
+     isDroppable cursor newTopView|
 
     self isDisabled ifTrue: [ ^ self ].
 
@@ -1248,6 +1248,16 @@
     newId := device viewIdFromPoint:screenPoint.
     newWidget := device viewFromId:newId.
 
+    "/ if the newWidget is inside another topView,
+    "/ raise it.
+    newWidget notNil ifTrue:[
+        newTopView := newWidget topView.
+        newTopView ~~ lastTopView ifTrue:[
+            newTopView raise.
+            lastTopView := newTopView
+        ].
+    ].
+    
     dropContext rootPoint:screenPoint.
     dropContext targetWidget:newWidget id:newId.
     handler dropContext:dropContext.
@@ -1313,6 +1323,8 @@
 
     newTarget notNil ifTrue:[ newTarget over:dropContext ].
     handler dragTo:screenPoint.
+
+    "Modified: / 05-06-2018 / 10:16:44 / Claus Gittinger"
 !
 
 buttonRelease:button x:x y:y view:aView