Example usage for javafx.scene.input ScrollEvent isShiftDown

List of usage examples for javafx.scene.input ScrollEvent isShiftDown

Introduction

In this page you can find the example usage for javafx.scene.input ScrollEvent isShiftDown.

Prototype

public final boolean isShiftDown() 

Source Link

Document

Indicates whether or not the Shift modifier is down on this event.

Usage

From source file:net.rptools.tokentool.controller.TokenTool_Controller.java

@FXML
void compositeTokenPane_OnScroll(ScrollEvent event) {
    // if event is touch enabled, skip this as it will be handled by onZoom & onRotate handlers
    if (event.isDirect())
        return;/*from   w ww .  ja v  a  2  s .  co m*/

    if (event.isShiftDown()) {
        // Note: OK, this is stupid but on Windows shift + mousewheel returns X delta but on Ubuntu it returns Y delta...
        double delta = event.getDeltaY();
        if (delta == 0)
            delta = event.getDeltaX();

        Double r = portraitImageView.getRotate() + delta / 20;

        if (r < -360d || r > 360d)
            r = 0d;

        portraitImageView.setRotate(r);
    } else {
        Double scale = portraitImageView.getScaleY() * Math.pow(1.001, event.getDeltaY());

        portraitImageView.setScaleX(scale);
        portraitImageView.setScaleY(scale);
    }

    event.consume();
    updateTokenPreviewImageView();
}