Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8248123

SCROLL instead of ZOOM events are generated using touchpad on windows laptop

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      ASUS ZenBook laptop with an integrated touchpad
      Windows 10 Pro (1909)
      OpenJDK 11.0.7
      JavaFX 15-ea-6

      A DESCRIPTION OF THE PROBLEM :
      Zoom gesture events (dragging two fingers apart on touchpad) are recognized as ScrollEvent. Only the difference between normal scroll and zoom is that ScrollEvent's methods isControlDown() and isShortcutDown() return true when firing event for zoom, but both methods return false if it is normal scroll.

      Just in case: the same gesture on the touch screen of the same laptop behaves as expected.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Run example code on a windows laptop with a touchpad.
      2. Make a zoom gesture in the opened window (dragging two fingers apart on touchpad)


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      events must be fired in sequence, according to Javadoc https://javadoc.io/doc/org.openjfx/javafx-base/latest/javafx.graphics/javafx/scene/input/ZoomEvent.html

      1. ZOOM_STARTED event
      2. multiple ZOOM events
      3. ZOOM_FINISHED event
      4. ZOOM events with inertia (if any)
      ACTUAL -
      multiple SCROLL events with isControlDown() == true and isShortcutDown() == true

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.input.ZoomEvent;
      import javafx.scene.layout.Pane;
      import javafx.stage.Stage;

      public class ZoomEventsApp extends Application {

          public static void main(String[] args) {
              Application.launch(args);
          }

          @Override
          public void start(Stage primaryStage) {
              var root = new Pane();
              root.addEventHandler(ZoomEvent.ANY, (event) -> {
                  System.out.print(event.getEventType());
                  if (event.isInertia()) System.out.print(" INERTIA");
                  if (event.isDirect()) System.out.print(" DIRECT");
                  if (event.isAltDown()) System.out.print(" ALT");
                  if (event.isControlDown()) System.out.print(" CTRL");
                  if (event.isMetaDown()) System.out.print(" META");
                  if (event.isShiftDown()) System.out.print(" SHIFT");
                  if (event.isShortcutDown()) System.out.print(" SHORTCUT");
                  System.out.println();
                  event.consume();
              });
              var scene = new Scene(root, 600, 400);
              primaryStage.setScene(scene);
              primaryStage.show();
          }

      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      * treat SCROLL events with isControlDown() == true as zoom actions
      * use touchscreen to generate correct events

      FREQUENCY : always


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: