Reputation: 838
I would like to zoom in/out on SVG file in java. I would like to do it from the program and can't find a way.
I know you can zoom in/out via mouse or keyboard but that is not what I'm looking for. I'm new to java (2 weeks of learning) and there is probably an easy solution to my problem but I can't find it.
Can anyone help me?
Upvotes: 2
Views: 2683
Reputation: 838
To properly zoom in/out on svg in java you need to use
AffineTransform at = new AffineTransform();
at.scale(X,Y);
svgCanvas.setRenderingTransform(at, true);
Note that you also need viewbox in your XML of svg.
Upvotes: 1
Reputation: 835
I think you want to call setRenderingTransform on your JSVGCanvas component. The method takes an AffineTransform and a boolean which says whether you want to redraw immediately.
Upvotes: 0