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

Documentation for Node bounding rectangles is misleading

XMLWordPrintable

      The javadocs discussing Bounding Rectangles for Node state:

      "The images show a filled and stroked rectangle and their bounds. The first rectangle [x:10.0 y:10.0 width:100.0 height:100.0 strokeWidth:0] has the following bounds bounds: [x:10.0 y:10.0 width:100.0 height:100.0]. The second rectangle [x:10.0 y:10.0 width:100.0 height:100.0 strokeWidth:5] has the following bounds: [x:5.0 y:5.0 width:110.0 height:110.0]. Since neither of the rectangles has any transformation applied, boundsInParent and boundsInLocal are the same."

      But I think that is wrong, or at least incomplete and potentially misleading. Rectangle is a Shape so the StrokeType matters here and the default StrokeType is CENTERED. (Though when I drop one on the Scene in Scene Builder, it defaults to INSIDE, something that I think should be considered a SceneBuilder bug.)

      So by default the bounds would be only extending 2.5 on each side for a total width and height of 105 and x and y coordinates of 7.5.

            psafrata Pavel Ĺ afrata
            swpalmer Scott Palmer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: