Dea5
Dea5

Reputation: 131

.setOnMouseMoved() ignored when mouse pressed and dragged

I have 3 questions I hope you can help me with!

1) [SOLVED] I have a Scene that contains some ImageView and a .setOnMouseMoved() binded to the parent Node that scales their dimensions based on the cursor position;

The problem is that, if I press the mouse button and keep it pressed, and then I move the cursor around the Scene, the .setOnMouseMoved() events are ignored and my ImageViews don't get scaled:

Is there a way to keep the .setOnMouseMoved() working even in this case?

2) My ImageViews also have a .setOnMouseClicked() event, but if I press the mouse on them and keep it pressed, move the cursor out the Scene, going again on top of the ImageView and realease it, the event is executed the same;

I don't the event to be executed if the mouse leaves the Scene, what can I do?

3) If I press and keep pressed the Stage bar (The bar containing the Application name, the minimize button and exit button) without moving the cursor, all the animation in my Scene freeze for around 1 second, then everything turn back to normal: why?

Thanks!

Upvotes: 0

Views: 358

Answers (1)

Smartie
Smartie

Reputation: 13

1) Try to use .setOnMouseDragged instead.

2) .setOnMouseClicked registers as soon as the mouse is clicked. This means that even when you drag out of the window, it will still register. Use .setOnMouseReleased if you don't want it to register when dragged outside the window.

3) Are you using java.util.Timer for the animations? If so, check out this.

Upvotes: 1

Related Questions