button press, move and release behaviour
authorca
Thu, 09 Nov 2006 08:41:35 +0100
changeset 3146 b7294baadfb7
parent 3145 cc5bd0e8013d
child 3147 b7c2db746f84
button press, move and release behaviour
SelectionInListModelView.st
--- a/SelectionInListModelView.st	Wed Nov 08 18:34:08 2006 +0100
+++ b/SelectionInListModelView.st	Thu Nov 09 08:41:35 2006 +0100
@@ -1205,7 +1205,7 @@
 buttonPress:button x:x y:y
     "a button was pressed - handle selection here
     "
-    |sensor item menu appl isSelected lineNr startLine clickPoint startDragDistance|
+    |sensor item menu appl isSelected lineNr startLine dragDistance|
 
     buttonMotionAction := buttonReleaseAction := nil.
 
@@ -1269,11 +1269,11 @@
     isSelected  := self isInSelection:lineNr.
 
     (self canDrag and:[sensor shiftDown not]) ifTrue:[
-        startDragDistance := UserPreferences current motionDistanceToStartDrag.
+        dragDistance := UserPreferences current motionDistanceToStartDrag.
 
         isSelected ifTrue:[
             buttonMotionAction := [:p|
-                ((x@y) dist:p) > startDragDistance ifTrue:[
+                ((x@y) dist:p) > dragDistance ifTrue:[
                     self startDragAt:p.
                 ]
             ].
@@ -1286,9 +1286,9 @@
         (isSelected or:[self canSelectIndex:lineNr forAdd:false]) ifTrue:[
             self buttonPressOrReleaseAtLine:lineNr x:x y:y.
 
-            (startDragDistance notNil and:[self isInSelection:lineNr]) ifTrue:[
+            (dragDistance notNil and:[self isInSelection:lineNr]) ifTrue:[
                 buttonMotionAction := [:p|
-                    ((x@y) dist:p) > startDragDistance ifTrue:[
+                    ((x@y) dist:p) > dragDistance ifTrue:[
                         self startDragAt:p.
                     ].
                 ].
@@ -1321,21 +1321,19 @@
         self buttonPressOrReleaseAtLine:lineNr x:x y:y.
     ].
 
-    clickPoint := x@y.
-
     multipleSelectOk ifTrue:[
         buttonMotionAction := [:p| |ln|
-            (p y between:0 and:height) ifTrue:[
+            (p y between:0 and:height) ifTrue:[ |ln|
                 ln := self yVisibleToLineNr:p y.
                 ln isNil ifTrue:[ln := self size].
 
                 (ln ~~ self lastInSelection and:[ln ~~ self firstInSelection]) ifTrue:[
                     self selectFrom:startLine to:ln.
-                    clickPoint := p.
+                    dragDistance := nil.   "/ selection changed - no longer dragable
                 ]
             ].
 
-            (startDragDistance notNil and:[(clickPoint x dist:p x) > startDragDistance]) ifTrue:[
+            (dragDistance notNil and:[(x dist:p x) > dragDistance]) ifTrue:[
                 self startDragAt:p.
             ].
         ].
@@ -2387,5 +2385,5 @@
 !SelectionInListModelView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInListModelView.st,v 1.117 2006-11-07 16:21:48 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInListModelView.st,v 1.118 2006-11-09 07:41:35 ca Exp $'
 ! !