Question

Does anyone know how can I zoom in a Scene (containing multiple Widgets), keeping the center of the visible area (or any given point, eg. the mouse location) constant ?

Doing this kind of thing with Swing-only components is not quite difficult, but with the NB 7.4 Visual library, I don't success in it...

Was it helpful?

Solution

The ActionFactory factory class provides several built-in actions.

For zoom it provides,

  • createCenteredZoomAction(double zoomMultiplier)
  • createMouseCenteredZoomAction(double zoomMultiplier)
  • createZoomAction()
  • createZoomAction(double zoomMultiplier, boolean animated)

Usage: To your Scene add this:

getActions().addAction(ActionFactory.createMouseCenteredZoomAction(1.1));

ActionFactory class docs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top