문제

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