I found an error in "setPannable (true)" that is not very smooth if the two drag and drop times are short.
How to solve it?
You need to manually use events.
private boolean dragged = false;
imageView.addEventFilter(MouseEvent.MOUSE_PRESSED, event -> {
dragged = true;
});
imageView.addEventFilter(MouseEvent.MOUSE_RELEASED, event -> {
dragged = false;
});
imageView.addEventFilter(MouseEvent.MOUSE_DRAGGED, event -> {
if (!dragged) {
event.consume();
}
});
scrollPane.setContent(imageView);
scrollPane.setPannable(true);
source
share