private void mouseWheel(MouseWheelEvent event) { if (diagramPane.getPopupMenu().isShowing() || ignoreMouseWheelEvent) return; Timer stopIgnoringEventTimer = new Timer() { @Override public void run() { ignoreMouseWheelEvent = false; } }; ignoreMouseWheelEvent = true; stopIgnoringEventTimer.schedule(250); Point scrollPoint = new Point(event.getX(), event.getY()); if (event.getDeltaY() < 0) { diagramPane.zoomIn(scrollPoint); } else if (event.getDeltaY() > 0) { diagramPane.zoomOut(scrollPoint); } diagramPane.update(); }
@Override public HandlerRegistration addMouseWheelHandler(final MouseWheelHandler handler) { return handlers.addHandler(MouseWheelEvent.getType(), handler); }
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) { return addDomHandler(handler, MouseWheelEvent.getType()); }