snap.svg.zpd
snap.svg.zpd copied to clipboard
Zooming threshold code
In your threshold code, you refuse values that exceed the threshold:
if (matrix.d >= threshold[1]) {
return;
}
This code can cause problems if:
- the mousewheel increases the zoom with large steps. For example: start=0, step=30, max=59. You will never get close to 59, you will be limited to 30.
- if I programmatically directly modify the transform attribute to apply a zoom that goes over the threshold, then I cannot zoom back with the mousewheel, it will be completely blocked.
- if you rotate the view, then matrix.d will not be your zoom factor anymore, which makes all your computations wrong. See matrix descriptions in: http://www.w3.org/TR/SVG/coords.html#EstablishingANewUserSpace
@jlgrall You are right on this. We need a better try to handle zoom threshold.
Any good idea for this @jlgrall ?