publiclab / Leaflet.DistortableImage

A Leaflet extension to distort or "rubber sheet" images
https://publiclab.github.io/Leaflet.DistortableImage/examples/
BSD 2-Clause "Simplified" License
270 stars 283 forks source link

Can I use this in a simple jsfiddle? #1008

Open bram2000 opened 2 years ago

bram2000 commented 2 years ago

Scope: I'd like to play with this library using jsfiddle.net or similar, but I can't figure out how to make it work.

Description: I've tried simply using <script src=...> to load in the .js as I do with other leaflet plugins, but It doesn't seem to work. I'm constantly getting the following error in console:

leaflet.distortableimage.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'Action')
    at Object.<anonymous> (leaflet.distortableimage.js:1:38912)
    at i (leaflet.distortableimage.js:1:110)
    at Object.<anonymous> (leaflet.distortableimage.js:1:1040)
    at i (leaflet.distortableimage.js:1:110)
    at leaflet.distortableimage.js:1:908
    at leaflet.distortableimage.js:1:917

It's very hard to debug further due to the minified javascript.

Thanks!

welcome[bot] commented 2 years ago

Thanks for opening your first issue here! Please follow the issue template to help us help you 👍🎉😄 If you have screenshots to share demonstrating the issue, that's really helpful! 📸 You can make a gif too!

bram2000 commented 2 years ago

I've even tried locally using a simple index.html file but get the same error.

jywarren commented 2 years ago

Hi, can you share a link to the fiddle you're using? It should be almost identical to the examples like https://publiclab.github.io/Leaflet.DistortableImage/examples/, but we should check the order of script tags, the version of Leaflet, and how you're initializing the library. Thanks!

gentlegiantJGC commented 1 year ago

Looks like this happens if you import leaflet-distortableimage before leaflet-toolbar. I don't know js but I would have thought this library should probably import leaflet-toolbar somewhere before using it to make sure it is patched in.