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

Some Node.localToSceneTransform may sometimes become inconsistent

XMLWordPrintable

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

      During Scene Builder debugging, I noticed that the Node.localToSceneTransform
      may become inconsistent i.e. we have no longer the equality:

             Point2D p1 = node.localToScene(0, 0);
             Point2D p2 = node.getLocalToSceneTransform().transform(0, 0);

      => p1.equals(p2); // With a numeric tolerance of course


      I failed to reproduce it outside SB2.

      However I have added some intrusmentation code to SB2 in order to exhibit the issue.

      Here is the steps to reproduce it using SB2:
      1) Start SB2 (under an IDE to get the standard output easily)
      2) Help -> About
      3) Press Alt+Shift and double click the JavaFX logo
          => this enables the debug menu
      4) Close the About window
          => you should see the Debug menu at right end of the menu bar
      5) Drop an AnchorPane from Library to Content panel
      6) Drop another AnchorPane on the previous AnchorPane
      7) Debug -> Check localToSceneTransform Properties in Content Panel
         => this command checks the equality mentioned above for all the objects
              in the content panel (i.e. below the dark background)
         => you should see the following output on stdout
      CHECK LOCAL TO SCENE TRANSFORM BEGINS
      CHECK LOCAL TO SCENE TRANSFORM ENDS
         => localToSceneTransform values are consistent
      8) Edit -> Trim to Selection
         => the inner AnchorPane becomes the root and the outer is deleted
      7) Debug -> Check localToSceneTransform Properties in Content Panel
         => you should see the following output on stdout
      CHECK LOCAL TO SCENE TRANSFORM BEGINS
      CHECK FAILED FOR Group[id=scalingGroup], p1=Point2D [x = 520.0, y = 305.0], p2=Point2D [x = 320.0, y = 205.0]
      CHECK FAILED FOR Rectangle[id=extensionRect, x=-20.0, y=-20.0, width=240.0, height=240.0, fill=0xffc0cb00, stroke=0x00000000, strokeWidth=1.0], p1=Point2D [x = 520.0, y = 305.0], p2=Point2D [x = 320.0, y = 205.0]
      CHECK FAILED FOR Label[id=backgroundPane, styleClass=stage-prompt-default]'', p1=Point2D [x = 520.0, y = 305.0], p2=Point2D [x = 320.0, y = 205.0]
      CHECK FAILED FOR Text[text="", x=0.0, y=0.0, alignment=CENTER, origin=BASELINE, boundsType=LOGICAL_VERTICAL_CENTER, font=Font[name=System Regular, family=System, style=Regular, size=16.0], fontSmoothingType=LCD, fill=0x4a4a4aff], p1=Point2D [x = 620.0, y = 421.0], p2=Point2D [x = 420.0, y = 321.0]
      CHECK FAILED FOR Deprecation$2@57a96578, p1=Point2D [x = 520.0, y = 305.0], p2=Point2D [x = 320.0, y = 205.0]
      CHECK FAILED FOR Deprecation$3@4dffa521[styleClass=root], p1=Point2D [x = 520.0, y = 305.0], p2=Point2D [x = 320.0, y = 205.0]
      CHECK FAILED FOR Group[id=contentGroup], p1=Point2D [x = 520.0, y = 305.0], p2=Point2D [x = 320.0, y = 205.0]
      CHECK FAILED FOR AnchorPane@250dc657, p1=Point2D [x = 520.0, y = 305.0], p2=Point2D [x = 320.0, y = 205.0]
      CHECK LOCAL TO SCENE TRANSFORM ENDS
         => some localToSceneTransform properties are now inconsistent
         => there is a constant error : (dx, dy) = (-200, -100)

      Usually resizing the window or moving the left/right splitter restores the consistency.
      But not always : I saw some cases where resizing the window increased the
      number of inconsistent properties.

            msladecek Martin Sládeček
            eleponn Eric Le Ponner
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: