I'm making a ScalaFX (but use of Scala is irrelevant here) application with a user interface similar to i.e. Google maps. There's panning and zooming.
For each such change of the user's viewpoint, I add a transform into a Group's .transforms
.
transforms += new Translate( dx, dy )
or
transforms += new Scale( 1/f,1/f, cx, cy )
This seems like the only way to affect transformations (apart from translateXYZ
, layoutXYZ
, which I'm ignoring), and it works.
The docs say this:
Multiple transformations may be applied to a node by specifying an ordered chain of transforms. The order in which the transforms are applied is defined by the ObservableList specified in the transforms variable.
Doesn't this imply that there's a list (even, an observable list) of potentially hundreds or thousands of entries long?
If so, I would like to flatten the list occasionally. Tried calling .localToSceneTransoform
and .localToParentTransform
for this (thinking I'd then set the .transforms with the received overall affine matrix). That crashed the JVM.
Am I doing something wrong here, or should I just stop caring about the list growing, well, indefinately?
Can provide a short ScalaFX sample code to highlight all this (including the crash). Please ask.
System: OS X, JVM 7u10