Leaflet.DistortableImage
Leaflet.DistortableImage copied to clipboard
Bug in safary 14.0: sourceCapabilities is undefined
Any click on the map in safary 14.0 causes the following error: TypeError: undefined is not an object (evaluating 'i.sourceCapabilities.firesTouchEvents')
Can be reproduced even in live demo https://publiclab.github.io/Leaflet.DistortableImage/examples/index.html
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!
i believe it! Im checking into it now thank you for reporting this
So its "experimental" according to MDN" but here is a good link about it if interested and also @jywarren https://developers.google.com/web/updates/2015/10/inputdevicecapabilities.
What it dose is indicate if the browser has native input touch event (not all do), so we can fire a synthetic one if it doesn't and don't end up firing it twice if it does.sourceCapabilities
is a ? for status in safari https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/sourceCapabilities so a few options:
- Just for @Arunar-betta right now, this bug occurs only on double clicking the map. This wiki describes how to turn the functionality off: https://github.com/publiclab/Leaflet.DistortableImage/wiki/singleclick-event.
- Or we can just use optional chaining, 1 line change
i?.sourceCapabilities?.firesTouchEvents
and error is gone - Ideally someone can take a fresh look. Tap events were broken on Leaflet when I implemented this, and we also specifically wanted images to be deselected on map click, but not dblclick (which is for the map labels), so I digressed from their source code a bit. Our touch usability is degrading a bit, sometimes double tap will deselect the image on my iPhone now. Another thing is that when you're done dragging an image, the toolbar is meant to re-appear again and it no longer does this. Maintenance burden :(
@jywarren and @TildaDares can I work on this ?