Example usage for javafx.scene.input ScrollEvent getY

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

Introduction

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

Prototype

public final double getY() 

Source Link

Document

Gets the vertical position of the event relative to the origin of the event's source.

Usage

From source file:de.hs.mannheim.modUro.controller.diagram.fx.interaction.ScrollHandlerFX.java

/**
 * Handle the case where a plot implements the {@link Zoomable} interface.
 *
 * @param zoomable  the zoomable plot./*from  w ww .  j  a  v a2 s .  c o  m*/
 * @param e  the mouse wheel event.
 */
private void handleZoomable(ChartCanvas canvas, Zoomable zoomable, ScrollEvent e) {
    // don't zoom unless the mouse pointer is in the plot's data area
    ChartRenderingInfo info = canvas.getRenderingInfo();
    PlotRenderingInfo pinfo = info.getPlotInfo();
    Point2D p = new Point2D.Double(e.getX(), e.getY());
    if (pinfo.getDataArea().contains(p)) {
        Plot plot = (Plot) zoomable;
        // do not notify while zooming each axis
        boolean notifyState = plot.isNotify();
        plot.setNotify(false);
        int clicks = (int) e.getDeltaY();
        double zf = 1.0 + this.zoomFactor;
        if (clicks < 0) {
            zf = 1.0 / zf;
        }
        if (true) { //this.chartPanel.isDomainZoomable()) {
            zoomable.zoomDomainAxes(zf, pinfo, p, true);
        }
        if (true) { //this.chartPanel.isRangeZoomable()) {
            zoomable.zoomRangeAxes(zf, pinfo, p, true);
        }
        plot.setNotify(notifyState); // this generates the change event too
    }
}