#BUGFIX by cg draft
authorClaus Gittinger <cg@exept.de>
Sun, 21 Jul 2019 07:10:38 +0200
changeset 3717 26224649d91c
parent 3716 08e97653176e
child 3718 28252bcf11ad
#BUGFIX by cg class: ShowMeHowItWorks added: #movePointerToComponent:speed: #movePointerToPosition:speed: #pointerMoveSpeedFast changed: #fastMoveTo: #movePointerToPosition:
ShowMeHowItWorks.st
--- a/ShowMeHowItWorks.st	Sat Jul 20 08:00:52 2019 +0200
+++ b/ShowMeHowItWorks.st	Sun Jul 21 07:10:38 2019 +0200
@@ -253,9 +253,10 @@
     |component|
 
     component := self componentNamed:componentName.
-    self movePointerToComponent:component.
+    self movePointerToComponent:component speed:(self pointerMoveSpeedFast).
 
     "Created: / 19-07-2019 / 15:39:23 / Claus Gittinger"
+    "Modified: / 20-07-2019 / 08:14:16 / Claus Gittinger"
 !
 
 moveTo:componentName
@@ -460,6 +461,12 @@
     "Created: / 19-07-2019 / 13:05:40 / Claus Gittinger"
 !
 
+pointerMoveSpeedFast
+    ^ 600.   "/ pixels per second
+
+    "Created: / 20-07-2019 / 08:13:58 / Claus Gittinger"
+!
+
 shortClickTime
     "when clicking"
 
@@ -694,8 +701,25 @@
     "Created: / 19-07-2019 / 16:18:58 / Claus Gittinger"
 !
 
+movePointerToComponent:aWidget speed:pixelsPerSecond
+    "move the mouse to aWidget's center"
+    
+    self movePointerToPosition:(aWidget screenBounds center rounded) speed:pixelsPerSecond.
+
+    "Created: / 20-07-2019 / 08:12:49 / Claus Gittinger"
+!
+
 movePointerToPosition:newPosition
     "move the mouse to newPosition"
+
+    self movePointerToPosition:newPosition speed:self pointerMoveSpeed
+
+    "Created: / 19-07-2019 / 12:57:30 / Claus Gittinger"
+    "Modified: / 20-07-2019 / 08:12:34 / Claus Gittinger"
+!
+
+movePointerToPosition:newPosition speed:pixelsPerSecond
+    "move the mouse to newPosition"
     
     |screen distance start numSteps moveTime stepDelayTime delta|
 
@@ -703,8 +727,8 @@
     start := screen pointerPosition.   
 
     distance := start dist:newPosition.
-    moveTime := (distance / self pointerMoveSpeed) seconds. "/ time to move
-    stepDelayTime := self pointerAnimationDelay.            "/ update every 50ms
+    moveTime := (distance / pixelsPerSecond) seconds.   "/ time to move
+    stepDelayTime := self pointerAnimationDelay.        "/ update every 50ms
     
     numSteps := moveTime / stepDelayTime.
     numSteps = 0 ifTrue:[
@@ -723,7 +747,7 @@
         Delay waitFor:stepDelayTime.
     ].
 
-    "Created: / 19-07-2019 / 12:57:30 / Claus Gittinger"
+    "Created: / 20-07-2019 / 08:12:07 / Claus Gittinger"
 ! !
 
 !ShowMeHowItWorks methodsFor:'menu actions - mouse buttons'!