To limit the zoom-out function:

        /**
         * Ascoltatore del sistema di zoom in/out "fluido"
         */
        canvas.getInteractors().add(new AbstractImageZoomInteractor() {

            @Override
            public boolean startInteraction(InputEvent ie) {
                int mods = ie.getModifiers();
                boolean b = ie.getID() == MouseEvent.MOUSE_PRESSED &&
isZoomOutClicked == true;
                return b;
            }

            @Override
            public void mouseReleased(MouseEvent e) {
                finished = true;
                JGVTComponent c = (JGVTComponent) e.getSource();
                AffineTransform pt = c.getPaintingTransform();
                if (pt != null) {
                    if (pt.getScaleX() < 1 || pt.getScaleY() < 1) {
                        // If the zoom-out goes beyond the original size
sets it on the default value
                        c.resetRenderingTransform();
                    } else {
                        AffineTransform rt = (AffineTransform)
c.getRenderingTransform().clone();
                        rt.preConcatenate(pt);
                        c.setRenderingTransform(rt);
                    }
                }
            }
        });


...hope this helps. Cheers :-)
-- 
View this message in context: 
http://www.nabble.com/Zoom-Out-Limit-tp23942547p23942547.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org

Reply via email to