The JSVGCanvas.ZOOM_IN_ACTION and ZOOM_OUT_ACTION are too abrupt for my
liking. I changed from the builtin zoom factors to smaller factors with the
following in my SVGViewBoard class (which extends JSVGCanvas):
ActionMap map = getActionMap();
map.put(JSVGCanvas.ZOOM_IN_ACTION, this.new ZoomAction(1.025));
map.put(JSVGCanvas.ZOOM_OUT_ACTION, this.new ZoomAction(0.975));
setActionMap(map);
and then registered a new ChangeListener on a JSlider object to allow users
to zoom in and out with a slider. The goal here was to zoom by the smaller
increments specified above, looping through them ten times and sleeping
between zooms to create an "animated" effect similar to what you would see
when zooming with Google maps. Here's the code I am using:
for (int j=0; j<10; j++) {
view.getActionMap().get(JSVGCanvas.ZOOM_IN_ACTION).actionPerformed(null);
Thread.sleep(100);
}
Pretty simple. The only problem is that while looping, the changes made to
the view object (an SVGViewBoard object) are not showing on the screen. If
I retrieve the scaling inside of the loop, I can see that it is being
properly updated on each iteration. The changes do not show up until the
loop completes, at which point the SVG has been properly rescaled to its
final desired size. What's the trick to this? I tried upping the sleep
time, and I've also tried running them through the UpdateManager, but I get
the same result.
--
View this message in context:
http://www.nabble.com/%22Animating%22-zoom-actions-tf2028501.html#a5578795
Sent from the Batik - Users forum at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]