DragHandler.st
changeset 3529 2250b416c0ae
parent 3160 7aa62ff13f85
child 3533 250bab773934
--- a/DragHandler.st	Thu Nov 26 17:20:45 2015 +0100
+++ b/DragHandler.st	Fri Dec 18 08:30:48 2015 +0100
@@ -11,6 +11,8 @@
 "
 "{ Package: 'stx:libview2' }"
 
+"{ NameSpace: Smalltalk }"
+
 Object subclass:#DragHandler
 	instanceVariableNames:'rootView lastRootPoint dropContext'
 	classVariableNames:''
@@ -323,7 +325,7 @@
 dragTo:aRootPoint
     "drag to a root point"
 
-    |p extent point area|
+    |p point area|
 
     (saveArea notNil and:[lastRootPoint notNil]) ifTrue:[
         (lastRootPoint = aRootPoint) ifTrue:[
@@ -337,7 +339,6 @@
     "/ copy from screen to saveUnder
     "/
     rootView clippedByChildren:false.
-    extent := saveUnder extent.
     point  := aRootPoint - dragOffset.
 
     saveArea notNil ifTrue:[
@@ -350,7 +351,7 @@
             "/ draggable objects no longer contained in saved area;
             "/ thus we have to restore the saved area on the screen.
             "/
-            self postDragging
+            self postDragging.
         ]
     ].
 
@@ -359,15 +360,14 @@
         "/ screen not yet saved; thus we have to save the area
         "/
         p := point  - (self class additionalSaveSize).
-
         saveUnder copyFrom:rootView 
                          x:p x
                          y:p y
                        toX:0 
                          y:0 
-                     width:extent x
-                    height:extent y.
-        saveArea := p extent:extent.
+                     width:saveUnder width
+                    height:saveUnder height.
+        saveArea := p extent:saveUnder extent.
     ].
     area := saveArea.
 
@@ -379,16 +379,10 @@
 
     dragBlock value:(point  - saveArea origin + dragOffset) value:tmpForm.
 
-    area == saveArea ifFalse:[
-        "saveArea changed during dragB;lock operation"
-        ^ self
+    "if saveArea changed during dragBlock; lock operation"
+    area == saveArea ifTrue:[
+        rootView copyFrom:tmpForm toX:area left y:area top. 
     ].
-
-    rootView copyFrom:tmpForm
-                    x:area origin x
-                    y:area origin y 
-                width:extent x 
-               height:extent y
 !
 
 dropTargetWillChange
@@ -403,28 +397,23 @@
 
 postDragging
     "restore from saveUnder for a generic opaque drag"
-    | origin extent |
+
+    |area|
 
     saveArea isNil ifTrue:[ ^ self ].
-    origin   := saveArea origin.
-    extent   := saveArea extent.
+    area := saveArea.
     saveArea := nil.
 
     rootView clippedByChildren:false.
-    "/ copy from saveUnder back to screen
+    "/ restore screen from saveUnder
     rootView copyFrom:saveUnder
-                    x: origin x
-                    y: origin y
-                width: extent x
-               height: extent y.
-
-    "Call #D1894600 - redraw artefakte bei drag im tree
-        work around copy again back than it works ???"
-    saveUnder copyFrom:rootView
-                     x: origin x
-                     y: origin y
-                 width: 1
-                height: 1.
+                   x:0
+                   y:0
+                  toX:area left
+                    y:area top
+                width:saveUnder width
+                height:saveUnder height
+                async:false.
 !
 
 preDraggingIn:aSourceWidget
@@ -450,15 +439,14 @@
 rereadSaveArea
     saveArea notNil ifTrue:[
         rootView clippedByChildren:false.
-        "/
-        "/ copy from saveUnder back to screen
-        "/
         saveUnder copyFrom:rootView 
-                        x:saveArea origin x 
-                        y:saveArea origin y 
-                    width:saveArea extent x  
-                   height:saveArea extent y.
-    ]
+                         x:saveArea left 
+                         y:saveArea top
+                       toX:0
+                         y:0
+                     width:saveArea width  
+                    height:saveArea height.
+    ].
 !
 
 restoreFromSaveArea
@@ -470,6 +458,6 @@
 !DragHandler class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/DragHandler.st,v 1.14 2013-05-17 12:58:16 mb Exp $'
+    ^ '$Header$'
 ! !