Skip to content

Commit 416e2a2

Browse files
committed
Manage measurecontrol with touch event instead of click event
1 parent 1994ebe commit 416e2a2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

mapentity/static/mapentity/Leaflet.MeasureControl/leaflet.measurecontrol.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
this._map.addLayer(this._markerGroup);
2929

3030
this._markers = [];
31-
this._map.on('click', this._onClick, this);
31+
this._map.on('touch', this._onTouch, this);
3232
this._startShape();
3333
}
3434
},
@@ -42,7 +42,7 @@
4242
this._map
4343
.off('pointermove', this._onMouseMove, this)
4444
.off('mousemove', this._onMouseMove, this)
45-
.off('click', this._onClick, this);
45+
.off('touch', this._onTouch, this);
4646

4747
this._clearGuides();
4848
this._container.style.cursor = '';
@@ -54,8 +54,8 @@
5454
this._drawing = true;
5555
this._poly = new L.Polyline([], this.options.shapeOptions);
5656
// this is added as a placeholder, if leaflet doesn't recieve
57-
// this when the tool is turned off all onclick events are removed
58-
this._poly._onClick = function () {};
57+
// this when the tool is turned off all onTouch events are removed
58+
this._poly._onTouch = function () {};
5959

6060
this._container.style.cursor = 'crosshair';
6161

@@ -88,7 +88,7 @@
8888
this._markerGroup.clearLayers();
8989
},
9090

91-
_onClick: function () {
91+
_onTouch: function () {
9292
if (!this._drawing) {
9393
this._removeShape();
9494
this._startShape();

0 commit comments

Comments
 (0)