I thought this code is maybe a little bit faster - but still not optimal. The
problem in both versions is certainly that there is a call to
setRenderingTransform() all the time instead of setPaintingTransform() like
in the default interactors.
----------------------------------------------------
public void mouseWheelMoved(MouseWheelEvent e) {
JGVTComponent c = (JGVTComponent)e.getSource();
xStart = e.getX();
yStart = e.getY();
double s;
if (e.getWheelRotation() < 0) {
s = 1.25;
}
else {
s = 0.8;
}
AffineTransform ot = c.getRenderingTransform();
double tx = -xStart * (s - 1.0);
double ty = -yStart * (s - 1.0);
AffineTransform st = AffineTransform.getTranslateInstance(tx,
ty);
AffineTransform at = AffineTransform.getScaleInstance(s,s);
ot.preConcatenate(at);
ot.preConcatenate(st);
c.setRenderingTransform(ot);
}
-----------------------------------------------------
hardc0d3r wrote:
>
> i have this code that uses the mouse wheel to zoom. it does work but its
> slow.. can anyone improve this code?
>
--
View this message in context:
http://www.nabble.com/Zoom-on-mouse-wheel-tp18171181p23535839.html
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]