What I'd like to achieve is the following:
When the left mouse-button is pressed AND the mouse is moved (while the mouse button is still pressed!) I would like to invoke a certain method. Basically I'd like to be able to move around the canvas, just like in e.g. Blender, where you navigate when your mouse-button is pressed and you move the mouse.
Now I know how to check on a certain event, like so:
val pane = new StackPane
pane.onMouseClicked = (event: MouseEvent) =>
{
// Mouse button was pressed
}
but how to do a inner-check now?
Something like this:
pane.onMouseClicked = (event: MouseEvent) =>
{
pane.onMouseMoved = (event: MouseEvent) => ()
}
will obviously not work, because when the button is pressed the first time, another handler is registered and would now/from here on fire whenever I move the mouse, which is not what I want.
Of course I searched, but I could not find anything appropriate AND without nasty hacks.