panzoom
panzoom copied to clipboard
Whether it supports Android and IOS
when move the svg element in android webview display this bug
Please check the call stack - see who passes the invalid values down to this method https://github.com/anvaka/panzoom/blob/master/index.js#L386
I got the same error. Happened when I did not specify a value for initialZoom
. This results in the ratio
calculated by zoomAbs
to be NaN
.
Here is the stack:
Error: zoom requires valid numbers
at zoomByRatio (vendor.js:130303)
at zoomAbs (vendor.js:130340)
at createPanZoom (vendor.js:130066)
at main.js:9772
at ZoneDelegate.invokeTask (polyfills.js:2037)
at Object.onInvokeTask (vendor.js:47334)
at ZoneDelegate.invokeTask (polyfills.js:2036)
at Zone.runTask (polyfills.js:1805)
at invokeTask (polyfills.js:2118)
at ZoneTask.invoke (polyfills.js:2107)
I think at least part of the issue is due to a typo when comparing against the scale in createPanZoom
:
if(initialX != transform.x || initialY != transform.y || initialZoom != transform.Scale){ <--- I think capital "S" here should be lowercase
zoomAbs(initialX, initialY, initialZoom);
}
Called with:
panzoom(imageElement, {
minZoom: 1,
maxZoom: 15,
bounds: true,
boundsPadding: 0.5,
autocenter: true
});
The change from @ralphstodomingo is merged. Can you please grab the latest version and see if the error is resolved?
Unfortunately, we also get this exception. We've tracked it down to this line. It happens at least in the following browsers:
- Chrome on Android (88, 89, 90, 91)
- Safari on iOs (14.0)
- Safari Webview on iOs (14.1, 14.2, 14.4, 14.6)
We're working on gathering more data to see which of the vars is NaN
.