This function prevents a canvas to zoom beyond a scalar constant value and, in case that a user keeps zooming inside it, the canvas returns the same rendering transform as before the zoom operation.
JSVGCanvas canvas = new JSVGCanvas() {
@Override
public void setRenderingTransform(AffineTransform at) {
if (at.getDeterminant() < ZOOM_IN_LIMIT) {
// Applies the new zoom level
setRenderingTransform(at, true);
} else {
// Redraws the last zoom level
scheduleGVTRendering();
}
}
};