Adding Scale and Rotation pivots for Node

Nir Lisker nlisker at gmail.com
Sun Mar 17 18:56:35 UTC 2019


I missed that the order is defined in a few places in the docs, so ignore
my side note. There is a place or two for improving the doc that can be
taken care of in a future documentation issue for 13.

On Fri, Mar 15, 2019 at 10:18 PM Nir Lisker <nlisker at gmail.com> wrote:

> Hi,
>
> I would like to implement properties for Node that control the pivots for
> its built-in rotation and scaling transformations. Currently, it is
> possible to do so only via a Rotate or Scale transforms, which are added to
> the node's getTransforms list as both pivots are set to the Node's center.
>
> This will make it easier to work with the built-in transforms and also
> allow the scale and rotate transitions to bind to these new properties as
> the next step, significantly reducing the complexity for these operations.
> JBS issues have been filed in the past for this in [1] and its linked
> issues.
>
> The internal implementation changes will be in
> Node#updateLocalToParentTransform() in the `if` block at line 5057 and will
> include translation operations to and from the pivots. It's also possible
> to separate the check for applying rotation and scaling to save on unneeded
> operations, I believe.
>
> One thing to look at carefully is the way the public API is defined. The
> pivots can be represented by a Point3D or a double for each axis. Scale
> transform use 3 doubles for both the scale amount and the pivot. Rotate
> transform uses 3 doubles for the pivot and a Point3D for the axis. It's not
> clear to me why this is the case.
>
> As a side note, the scale and rotation built-in transforms are defined
> internally in a specific order, and this order does not appear to be
> documented. That is, if I setRotate(90) and setScaleX(2) I can not know
> a-priori if I will scale X (scale before rotate) or Y (scale after rotate).
>
> Comments are welcome.
>
> - Nir
>
> [1] https://bugs.openjdk.java.net/browse/JDK-8092304
>


More information about the openjfx-discuss mailing list