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

coordinate translation methods such as Node's parentToLocal, sceneToLocal, localToParent, localToScene need to take geometry altering effects into account.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • fx1.2
    • fx1.2
    • javafx
    • None


      Coordinate translation methods such as Node's parentToLocal, sceneToLocal, localToParent, localToScene need to take geometry altering effects into account. Right now they use only translations and ignore effects completely. Some of the effects alter node's geometry and have to be used for coordinate translation otherwise coordinate translation and all the things which depend on it such as mouse event delivery are broken. For example if a node has PerspectiveTransform applied to it then translation methods of such a node do not work correctly.

      Try the following for example:
      =====
      import javafx.scene.*;
      import javafx.scene.effect.*;
      import javafx.scene.shape.*;
      import javafx.scene.input.*;
      import java.lang.Math;

      var width = 200;
      var height = 200;
      var radius = width/2;
      var back = height/10;
      var t = 3.14 / 8;;

      Rectangle {
          x:10 y:10 width:100 height:100
          effect: PerspectiveTransform {
              ulx: radius - Math.sin(t)*radius uly: 0 - Math.cos(t)*back
              urx: radius + Math.sin(t)*radius ury: 0 + Math.cos(t)*back
              lrx: radius + Math.sin(t)*radius lry: height - Math.cos(t)*back
              llx: radius - Math.sin(t)*radius lly: height + Math.cos(t)*back
          }
          onMouseMoved:function(e:MouseEvent):Void {
              println(e);
          }
      }
      =====
      The right side of the transformed rectangle does not react on mouse at all.

            kcr Kevin Rushforth
            idk Igor Kushnirskiy (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: