下面列出了javafx.scene.input.ScrollEvent#isAltDown ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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();
}
/**
* 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());
}
/**
* Returns <code>true</code> if the given {@link ScrollEvent} should trigger
* zooming. Otherwise returns <code>false</code>. Per default, either
* <code><Control></code> or <code><Alt></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();
}