List of usage examples for javafx.scene.input ScrollEvent getDeltaY
public double getDeltaY()
From source file:uk.bl.dpt.qa.gui.DissimilarGUIThread.java
@FXML void mouseScroll(ScrollEvent event) { event.consume();/*from w w w . j av a 2 s . c om*/ final double diff = 0.1; //scroll pane locations final double h = scrollPaneLeft.getHvalue(); final double v = scrollPaneLeft.getVvalue(); final double min = 400; if (event.getDeltaY() > 0 && ((imageLeft.getBoundsInParent().getWidth() < min) || imageLeft.getBoundsInParent().getHeight() < min)) { return; } if (event.getDeltaY() < 0) { imageLeft.setScaleX(imageLeft.getScaleX() + diff); imageLeft.setScaleY(imageLeft.getScaleY() + diff); } else { imageLeft.setScaleX(imageLeft.getScaleX() - diff); imageLeft.setScaleY(imageLeft.getScaleY() - diff); } imageRight.setScaleX(imageLeft.getScaleX()); imageRight.setScaleY(imageLeft.getScaleY()); //just set the same ratio of scroll - this should work out mostly ok scrollPaneLeft.setHvalue(h); scrollPaneLeft.setVvalue(v); }