I have a canvas with an icon in the upper right hand corner.
What I would like is this:
- the user clicks the icon
- user holds down their mouse button
- user slides the mouse left/right in order to move the canvas the same direction.
Here’s the thing that’s stumping me… I don’t want the canvas to move until the mouse has traveled a certain distance (in pixels). Then, once the mouse has passed that many pixels, the projects needs to move the same amount of pixels.
Is there a way to find how many pixels the mouse has moved since the mouse was clicked?
On MOUSE_DOWN MouseEvent get mouseX on MOUSE_MOVE MouseEvent get mouseX compair the two values and you have your answer.
Make sure you up date the old mouseX with the new mouseX if the compaired value is greater then the amount you want.