سؤال

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