Пример #1
0
 /**
  * Add the correct event button types to the set according to the mouse event.
  *
  * @param event the mouse event
  * @param types the set of types
  * @throws NullPointerException if event or types is null
  */
 public static void addButtonTypes(final ProxyMouseEvent event, final Set<CameraEventType> types) {
   // process the button number
   switch (event.getButton()) {
     case WHEEL:
       if (event.getWheelRotation() < 0) {
         types.add(CameraEventType.WHEEL_UP);
       } else if (event.getWheelRotation() > 0) {
         types.add(CameraEventType.WHEEL_DOWN);
       } else {
         types.add(CameraEventType.NONE);
       }
       break;
     case BUTTON1:
       types.add(CameraEventType.LEFT);
       break;
     case BUTTON2:
       types.add(CameraEventType.MIDDLE);
       break;
     case BUTTON3:
       types.add(CameraEventType.RIGHT);
       break;
     default:
       types.add(CameraEventType.NONE);
       break;
   }
 }
Пример #2
0
 /**
  * Get the button for the supplied event.
  *
  * @param event the mouse event
  * @return the button
  * @throws NullPointerException if event is null
  */
 public static CameraEventType getButton(final ProxyMouseEvent event) {
   switch (event.getButton()) {
     case BUTTON1:
       return CameraEventType.LEFT;
     case BUTTON2:
       return CameraEventType.MIDDLE;
     case BUTTON3:
       return CameraEventType.RIGHT;
     default:
       return CameraEventType.NONE;
   }
 }