Java Reference
In-Depth Information
BoundsInLocal
defines the bounds before any transformations have been
applied. However,
boundsInLocal
does take into effect any changes required by
clipping and special effects. For shapes, this bounded area also includes any non-
zero strokes that may fall outside of the shape's geometry. For special effects,
added space may be included to achieve the effect. For example,
DropShadow
includes a radius variable (default is 10.0) that is added to the overall dimensions
for the node.
LayoutBounds
defines the rectangular bounds after applying any transforms to the
node. By design, the transformations specified by
translateX
and
translateY
are not included in this calculation. This is because if you are trying to position a
node binding
translateX
and
translateY
based on the
layoutBounds
, you
would enter into a circular change condition that would create an endless loop.
LayoutBounds
should be used when laying out nodes in an area.
BoundsInParent
defines the rectangular area after applying all transformations
to the node. This bounding rectangle is in the parent's coordinate space. How-
ever, it is still calculated if there is no parent.
BoundsInScene
defines the rectangular area of the node after all its ancestor
node's transformations have been applied. If the node is attached to a
Scene
, this
would be in the
Scene
's coordinate space. Otherwise, it is in the coordinate space
or the topmost node in the scene graph.
To illustrate the differences in these, let's look at an example. This example uses
a rectangle that is originally 50 by 50 in size. It has a
DropShadow
effect, and is
scaled on the
x
axis by a factor of 1.2. The rectangle is positioned horizontally in
the center of the scene and down 50 along the
y
axis. The rectangle belongs to a
group that is rotated 45 degrees, and this group belongs to a scene. Listing 5.17
shows the code required for this.
Listing 5.17
Layout Geometry
scene: scene = Scene {
content: [
Group {
rotate: 45
content: [
rect =
Rectangle
{
translateX: bind (scene.width -
rect.layoutBounds.width)/2.0 -
rect.layoutBounds.minX;
translateY: 50
transforms: Transform.scale(1.2,1.0)
width: 50
Search WWH ::
Custom Search