only track events when "pointerdown" event was received, because on native android browser wrong move events are sent with no "pointerdown" event
This commit is contained in:
@@ -84,7 +84,11 @@ ol.interaction.PointerInteraction.prototype.updateTrackedTouches_ =
|
|||||||
|
|
||||||
if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.POINTERUP) {
|
if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.POINTERUP) {
|
||||||
delete this.trackedTouches_[event.pointerId];
|
delete this.trackedTouches_[event.pointerId];
|
||||||
} else {
|
} else if (mapBrowserEvent.type ==
|
||||||
|
ol.MapBrowserEvent.EventType.POINTERDOWN) {
|
||||||
|
this.trackedTouches_[event.pointerId] = event;
|
||||||
|
} else if (event.pointerId in this.trackedTouches_) {
|
||||||
|
// update only when there was a pointerdown event for this pointer
|
||||||
this.trackedTouches_[event.pointerId] = event;
|
this.trackedTouches_[event.pointerId] = event;
|
||||||
}
|
}
|
||||||
this.targetTouches = goog.object.getValues(this.trackedTouches_);
|
this.targetTouches = goog.object.getValues(this.trackedTouches_);
|
||||||
@@ -96,7 +100,8 @@ ol.interaction.PointerInteraction.prototype.updateTrackedTouches_ =
|
|||||||
* @param {ol.MapBrowserEvent} mapBrowserEvent Event.
|
* @param {ol.MapBrowserEvent} mapBrowserEvent Event.
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
ol.interaction.PointerInteraction.prototype.handlePointerMove = goog.nullFunction;
|
ol.interaction.PointerInteraction.prototype.handlePointerMove =
|
||||||
|
goog.nullFunction;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ ol.MapBrowserEventHandler = function(map) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.activePointers_ = 0;
|
this.activePointers_ = 0;
|
||||||
|
this.trackedTouches_ = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ol.pointer.PointerEventHandler}
|
* @type {ol.pointer.PointerEventHandler}
|
||||||
@@ -206,10 +207,11 @@ ol.MapBrowserEventHandler.prototype.updateActivePointers_ =
|
|||||||
|
|
||||||
if (event.type == ol.MapBrowserEvent.EventType.POINTERUP ||
|
if (event.type == ol.MapBrowserEvent.EventType.POINTERUP ||
|
||||||
event.type == ol.MapBrowserEvent.EventType.POINTERCANCEL) {
|
event.type == ol.MapBrowserEvent.EventType.POINTERCANCEL) {
|
||||||
this.activePointers_--;
|
delete this.trackedTouches_[event.pointerId];
|
||||||
} else if (event.type == ol.MapBrowserEvent.EventType.POINTERDOWN) {
|
} else if (event.type == ol.MapBrowserEvent.EventType.POINTERDOWN) {
|
||||||
this.activePointers_++;
|
this.trackedTouches_[event.pointerId] = true;
|
||||||
}
|
}
|
||||||
|
this.activePointers_ = goog.object.getCount(this.trackedTouches_);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user