Domanda

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...

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top