2

I have a map with events associated with "click" that get fired when using mouse but if I use the touch screen they don't example

map.on("click", () => console.log("blarg")

blarg gets logged if I click on the map with a mouse but does not if I touch the map with a touchscreen. This is on a windows computer and in an electron app (latest version of mapboxgl-js)

cheesemas46
  • 139
  • 12
  • That sounds like a bug, or an issue to raise at http://github.com/mapbox/mapbox-gl-js/issues . Normally, Mapbox-GL-JS works well on touchscreens. – Steve Bennett Dec 16 '19 at 21:12

1 Answers1

0

There are already similar questions answered on Stack Overflow:
Would onClick event work on touch on touch-screen devices?
document .click function for touch device

You can use touchstart and touchend events that are similar to mousedown and mouseup or use jQuery to detect taps.
Supporting both TouchEvent and MouseEvent - MDN

Teo M
  • 56
  • 4