@Override
  public void mouseWheelMoved(final MouseWheelEvent e) {
    //		System.out.println( "MouseAndKeyHandler.mouseWheelMoved()" );
    //		System.out.println( e );
    update();

    final int mask = getMask(e);
    final int x = e.getX();
    final int y = e.getY();
    final double wheelRotation = e.getPreciseWheelRotation();

    /*
     * AWT uses the SHIFT_DOWN_MASK to indicate horizontal scrolling. We
     * keep track of whether the SHIFT key was actually pressed for
     * disambiguation. However, we can only detect horizontal scrolling if
     * the SHIFT key is not pressed. With SHIFT pressed, everything is
     * treated as vertical scrolling.
     */
    final boolean exShiftMask = (e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) != 0;
    final boolean isHorizontal = !shiftPressed && exShiftMask;

    for (final BehaviourEntry<ScrollBehaviour> scroll : scrolls) {
      if (scroll.buttons.matches(mask, pressedKeys)) {
        scroll.behaviour.scroll(wheelRotation, isHorizontal, x, y);
      }
    }
  }
Esempio n. 2
0
 @Override
 public void mouseWheelMoved(final MouseWheelEvent e) {
   final double v = keyModfiedSpeed(e.getModifiersEx());
   final int s = e.getWheelRotation();
   p.setF(p.getF() * (1 - 0.05f * s * v));
   update(false);
 }