Вопрос

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

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top