C
C
cyrilbondarenko2021-02-05 13:34:32
JavaScript
cyrilbondarenko, 2021-02-05 13:34:32

How to make the map react not only to mouse events, but also to touching the screen?

Good afternoon.

https://yandex.ru/dev/maps/jsbox/2.1/polygon_custom/

How to make area selection work on mobile devices too?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton, 2021-02-05
Semenov

Take advantage of events for touches.
Read here: https://developer.mozilla.org/ru/docs/Web/API/Touc...

// Подпишемся на событие отпускания кнопки мыши.
    map.events.add('mouseup', function (e) {

Add events like:
map.events.add('touchstart', function (e) {...
map.events.add('touchmove', function (e) {...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question