UIGalleryView.st
changeset 278 5b7dfe33b497
parent 247 b4d3f54f2128
child 289 7bbe22b39d9b
--- a/UIGalleryView.st	Fri Aug 08 18:40:24 1997 +0200
+++ b/UIGalleryView.st	Mon Aug 11 14:07:53 1997 +0200
@@ -419,6 +419,37 @@
         DragAndDropManager startDrag:dragObj from:inputView.
     ]
 
+!
+
+startDragWithOffset:offs
+    "start drag of selection
+    "
+    |dragObj spec name o|
+
+    spec := self findSpecFor:selection.
+
+    spec notNil ifTrue:[
+        spec := self buildSpecFrom:spec.
+        name := spec className asString.
+        name := name copyFrom:1 to:(name size - ('Spec' size) + 1). 
+        name at:1 put:(name at:1) asLowercase.
+        name at:(name size) put:$1.
+        spec name:name.
+
+        self showUnselected.
+        dragObj := DropSpec for:selection specification:spec.
+        self showSelected.
+
+        o := lastClickPoint - selection origin.
+
+        DragAndDropManager 
+            startDrag:dragObj 
+            from:inputView
+            offset:o.
+    ]
+
+    "Created: 11.8.1997 / 00:44:17 / cg"
+    "Modified: 11.8.1997 / 00:48:35 / cg"
 ! !
 
 !UIGalleryView::Canvas methodsFor:'event handling'!
@@ -432,12 +463,12 @@
         sensor := self sensor.
         sensor anyButtonPressed ifTrue:[
             (lastClickPoint dist:(x@y)) > 10.0 ifTrue:[
-                ^ self startDrag
+                ^ self startDragWithOffset:(x@y) - lastClickPoint
             ]
         ]
     ]
 
-
+    "Modified: 11.8.1997 / 00:44:49 / cg"
 !
 
 buttonPress:button x:x y:y