Seinfeld
Seinfeld

Reputation: 433

How to get longitude and latitude on tablet devices ? JS Mapbox

I've to drag and drop custom icons (not mapbox markers) to map and that works for me on large screens since Mapbox API provides [lng, lat] tracker using mouse cursor. So, once I have position of my icon, I'm able to manipulate with it much better.

However, same has to be done on tablet screen, but since tablet does not have cursor I don't have any access to lng, lat data while dragging the item. I went over documentation several times, but haven't had any luck.

Does Mapbox provide any kind of support for tablet devices ?

map.on('mousemove', function (e) {

});

This is for large and medium screens, but is there any event for touch screens ?

Upvotes: 1

Views: 49

Answers (1)

Vince
Vince

Reputation: 979

There is a touchmove event for the map, or get the location on dragend or the icon.

Depends if you drag the icon or the map.

Upvotes: 1

Related Questions