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

Ensemble8 Gesture and Multi-Touch tabs fumble rotation events

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8u60
    • 8u20
    • javafx
    • None

      The gesture tab in Ensemble8 claims to recognize rotation events, and you can see the rotation events in the log, but the square struggles with representing that rotation. It looks like the problem is that the rotation events may be "relative", as in "rotate another 2 degrees", but they are applied using setRotation. In order to make the effect "relative" the event's rotation is added to a node's existing rotation, but it looks like the wrong node is used for the "existing rotation". See this line in the demo:

                  rec.setRotate(listeningNode.getRotate() + event.getAngle());

      Perhaps that should be:

                  rec.setRotate(rec.getRotate() + event.getAngle());

      instead?

      Also, as noted below, the Multi-Touch tab does implement relative rotation events, but it doesn't keep a history of rotations between individual gesture sequences. It appears that the starting rotation (and scale) are snapshotted, but the corresponding rotation (and scale) events are not executed relative to the snapshotted starting point:

              addEventHandler(ZoomEvent.ZOOM, (ZoomEvent event) -> {
                  setScaleX(event.getTotalZoomFactor());
                  setScaleY(event.getTotalZoomFactor());
              });
              addEventHandler(RotateEvent.ROTATE, (RotateEvent event) -> {
                  setRotate(event.getTotalAngle());
              });

      should probably be:

              addEventHandler(ZoomEvent.ZOOM, (ZoomEvent event) -> {
                  setScaleX(startScale * event.getTotalZoomFactor());
                  setScaleY(startScale * event.getTotalZoomFactor());
              });
              addEventHandler(RotateEvent.ROTATE, (RotateEvent event) -> {
                  setRotate(startRotate + event.getTotalAngle());
              });

            morris Morris Meyer (Inactive)
            flar Jim Graham
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: