Java Code Examples for javafx.scene.input.ScrollEvent#isAltDown()

The following examples show how to use javafx.scene.input.ScrollEvent#isAltDown() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebViewEventDispatcher.java    From oim-fx with MIT License 5 votes vote down vote up
private void processScrollEvent(ScrollEvent ev) {
    if (page == null) {
        return;
    }
    double dx = - ev.getDeltaX() * webView.getFontScale() * webView.getScaleX();
    double dy = - ev.getDeltaY() * webView.getFontScale() * webView.getScaleY();
    WCMouseWheelEvent wheelEvent =
            new WCMouseWheelEvent((int)ev.getX(), (int)ev.getY(),
                (int)ev.getScreenX(), (int)ev.getScreenY(),
                System.currentTimeMillis(),
                ev.isShiftDown(), ev.isControlDown(), ev.isAltDown(),
                ev.isMetaDown(), (float)dx, (float)dy);
    page.dispatchMouseWheelEvent(wheelEvent);
    ev.consume();
}
 
Example 2
Source File: PanOrZoomOnScrollHandler.java    From gef with Eclipse Public License 2.0 3 votes vote down vote up
/**
 * Returns <code>true</code> if the given {@link ScrollEvent} should trigger
 * panning. Otherwise returns <code>false</code>.
 *
 * @param event
 *            The {@link ScrollEvent} in question.
 * @return <code>true</code> to indicate that the given {@link ScrollEvent}
 *         should trigger panning, otherwise <code>false</code>.
 */
protected boolean isPan(ScrollEvent event) {
	// Do not scroll when a modifier key (<Alt>, <Control>, <Meta>) is
	// pressed.
	return !(event.isAltDown() || event.isControlDown()
			|| event.isMetaDown());
}
 
Example 3
Source File: PanOrZoomOnScrollHandler.java    From gef with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Returns <code>true</code> if the given {@link ScrollEvent} should trigger
 * zooming. Otherwise returns <code>false</code>. Per default, either
 * <code>&lt;Control&gt;</code> or <code>&lt;Alt&gt;</code> has to be
 * pressed so that <code>true</code> is returned.
 *
 * @param event
 *            The {@link ScrollEvent} in question.
 * @return <code>true</code> if the given {@link ScrollEvent} should trigger
 *         zooming, otherwise <code>false</code>.
 */
protected boolean isZoom(ScrollEvent event) {
	return event.isControlDown() || event.isAltDown();
}