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();
  }
示例#2
0
 @Override
 public HandlerRegistration addMouseWheelHandler(final MouseWheelHandler handler) {
   return handlers.addHandler(MouseWheelEvent.getType(), handler);
 }
示例#3
0
 public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
   return addDomHandler(handler, MouseWheelEvent.getType());
 }