Back in the 1.5 days, I created a app, based on the Batik libraries, to view
our svg documents. Squiggle was both more and less than what we needed.
The big thing was we wanted the ability to pan around a document, then zoom
in a bit and still be able to pan around the document.
In Batik 1.6, there were some contributed X classes (like XJSVGCanvas) that
helped with this. Now, in 1.7, it does not look like these are necessary.
Looking that the ScrollExample.java included in the source distribution, it
seems like this is just built in now. That is fantastic!
So, now as I try to incorporate this using Batik 1.7 I am having some
problems.
There are three things I want to do:
1) allow zooming via a toolbar control
-- Abbreviated feature set
--If the vertical scroll bar is 0,
zoom in and keep vertical scroll bar value 0
--If vertical scroll bar is not 0,
zoom in and keeping the center of the viewable area
in the center after the zoom as much as possible
2) allow zooming via mouse double-click, centering on the MouseEvent
3) Have a fit-to-page and a fit-width (like Acrobat's)
If someone could give me a nudge in the right direction, I would really
appeciate it. Here is a sample of the code I have that does not work. I
would have expected this to work. Also, for the first 2 items, how can I
specify the region I want to scroll to? What I had to do before is set this
after I got a gvtRenderingStarted event. Is there a more straightforward
way of doing this?
Thanks,
Mark
-----------
canvas is a JSVGCanvas
scroller is a JSVGScrollPane
private void matchWidth() {
Dimension2D docSize = canvas.getSVGDocumentSize();
Dimension panelSize = scroller.getSize();
double scaleFactor =
panelSize.getWidth()/docSize.getWidth();
canvas.setRenderingTransform(AffineTransform.getScaleInstance(scaleFactor ,
scaleFactor ));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]