panzoom icon indicating copy to clipboard operation
panzoom copied to clipboard

Whether it supports Android and IOS

Open txlwll opened this issue 4 years ago • 4 comments

image

when move the svg element in android webview display this bug

txlwll avatar Dec 01 '20 13:12 txlwll

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

anvaka avatar Dec 02 '20 05:12 anvaka

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
});

cmdickson avatar Dec 08 '20 20:12 cmdickson

The change from @ralphstodomingo is merged. Can you please grab the latest version and see if the error is resolved?

anvaka avatar Apr 08 '21 07:04 anvaka

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.

tomhooijenga avatar Jun 16 '21 14:06 tomhooijenga