Shared module for map browser event type enum
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
goog.provide('ol.interaction.DoubleClickZoom');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.MapBrowserEvent');
|
||||
goog.require('ol.MapBrowserEventType');
|
||||
goog.require('ol.interaction.Interaction');
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ ol.inherits(ol.interaction.DoubleClickZoom, ol.interaction.Interaction);
|
||||
ol.interaction.DoubleClickZoom.handleEvent = function(mapBrowserEvent) {
|
||||
var stopEvent = false;
|
||||
var browserEvent = mapBrowserEvent.originalEvent;
|
||||
if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.DBLCLICK) {
|
||||
if (mapBrowserEvent.type == ol.MapBrowserEventType.DBLCLICK) {
|
||||
var map = mapBrowserEvent.map;
|
||||
var anchor = mapBrowserEvent.coordinate;
|
||||
var delta = browserEvent.shiftKey ? -this.delta_ : this.delta_;
|
||||
|
||||
@@ -2,7 +2,7 @@ goog.provide('ol.interaction.Draw');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.MapBrowserEvent');
|
||||
goog.require('ol.MapBrowserEventType');
|
||||
goog.require('ol.Object');
|
||||
goog.require('ol.coordinate');
|
||||
goog.require('ol.events');
|
||||
@@ -304,13 +304,13 @@ ol.interaction.Draw.handleEvent = function(event) {
|
||||
this.freehand_ = this.mode_ !== ol.interaction.Draw.Mode_.POINT && this.freehandCondition_(event);
|
||||
var pass = !this.freehand_;
|
||||
if (this.freehand_ &&
|
||||
event.type === ol.MapBrowserEvent.EventType.POINTERDRAG && this.sketchFeature_ !== null) {
|
||||
event.type === ol.MapBrowserEventType.POINTERDRAG && this.sketchFeature_ !== null) {
|
||||
this.addToDrawing_(event);
|
||||
pass = false;
|
||||
} else if (event.type ===
|
||||
ol.MapBrowserEvent.EventType.POINTERMOVE) {
|
||||
ol.MapBrowserEventType.POINTERMOVE) {
|
||||
pass = this.handlePointerMove_(event);
|
||||
} else if (event.type === ol.MapBrowserEvent.EventType.DBLCLICK) {
|
||||
} else if (event.type === ol.MapBrowserEventType.DBLCLICK) {
|
||||
pass = false;
|
||||
}
|
||||
return ol.interaction.Pointer.handleEvent.call(this, event) && pass;
|
||||
|
||||
@@ -2,7 +2,7 @@ goog.provide('ol.interaction.Extent');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.MapBrowserEvent');
|
||||
goog.require('ol.MapBrowserEventType');
|
||||
goog.require('ol.MapBrowserPointerEvent');
|
||||
goog.require('ol.coordinate');
|
||||
goog.require('ol.events.Event');
|
||||
@@ -132,7 +132,7 @@ ol.interaction.Extent.handleEvent_ = function(mapBrowserEvent) {
|
||||
return true;
|
||||
}
|
||||
//display pointer (if not dragging)
|
||||
if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.POINTERMOVE && !this.handlingDownUpSequence) {
|
||||
if (mapBrowserEvent.type == ol.MapBrowserEventType.POINTERMOVE && !this.handlingDownUpSequence) {
|
||||
this.handlePointerMove_(mapBrowserEvent);
|
||||
}
|
||||
//call pointer to determine up/down/drag
|
||||
|
||||
@@ -3,7 +3,7 @@ goog.provide('ol.interaction.Modify');
|
||||
goog.require('ol');
|
||||
goog.require('ol.CollectionEventType');
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.MapBrowserEvent');
|
||||
goog.require('ol.MapBrowserEventType');
|
||||
goog.require('ol.MapBrowserPointerEvent');
|
||||
goog.require('ol.ViewHint');
|
||||
goog.require('ol.array');
|
||||
@@ -656,12 +656,12 @@ ol.interaction.Modify.handleEvent = function(mapBrowserEvent) {
|
||||
|
||||
var handled;
|
||||
if (!mapBrowserEvent.map.getView().getHints()[ol.ViewHint.INTERACTING] &&
|
||||
mapBrowserEvent.type == ol.MapBrowserEvent.EventType.POINTERMOVE &&
|
||||
mapBrowserEvent.type == ol.MapBrowserEventType.POINTERMOVE &&
|
||||
!this.handlingDownUpSequence) {
|
||||
this.handlePointerMove_(mapBrowserEvent);
|
||||
}
|
||||
if (this.vertexFeature_ && this.deleteCondition_(mapBrowserEvent)) {
|
||||
if (mapBrowserEvent.type != ol.MapBrowserEvent.EventType.SINGLECLICK ||
|
||||
if (mapBrowserEvent.type != ol.MapBrowserEventType.SINGLECLICK ||
|
||||
!this.ignoreNextSingleClick_) {
|
||||
handled = this.removePoint();
|
||||
} else {
|
||||
@@ -669,7 +669,7 @@ ol.interaction.Modify.handleEvent = function(mapBrowserEvent) {
|
||||
}
|
||||
}
|
||||
|
||||
if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.SINGLECLICK) {
|
||||
if (mapBrowserEvent.type == ol.MapBrowserEventType.SINGLECLICK) {
|
||||
this.ignoreNextSingleClick_ = false;
|
||||
}
|
||||
|
||||
@@ -823,7 +823,7 @@ ol.interaction.Modify.prototype.insertVertex_ = function(segmentData, vertex) {
|
||||
* @api
|
||||
*/
|
||||
ol.interaction.Modify.prototype.removePoint = function() {
|
||||
if (this.lastPointerEvent_ && this.lastPointerEvent_.type != ol.MapBrowserEvent.EventType.POINTERDRAG) {
|
||||
if (this.lastPointerEvent_ && this.lastPointerEvent_.type != ol.MapBrowserEventType.POINTERDRAG) {
|
||||
var evt = this.lastPointerEvent_;
|
||||
this.willModifyFeatures_(evt);
|
||||
this.removeVertex_();
|
||||
|
||||
@@ -2,7 +2,7 @@ goog.provide('ol.interaction.Pointer');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.functions');
|
||||
goog.require('ol.MapBrowserEvent');
|
||||
goog.require('ol.MapBrowserEventType');
|
||||
goog.require('ol.MapBrowserPointerEvent');
|
||||
goog.require('ol.interaction.Interaction');
|
||||
goog.require('ol.obj');
|
||||
@@ -109,9 +109,9 @@ ol.interaction.Pointer.centroid = function(pointerEvents) {
|
||||
ol.interaction.Pointer.prototype.isPointerDraggingEvent_ = function(mapBrowserEvent) {
|
||||
var type = mapBrowserEvent.type;
|
||||
return (
|
||||
type === ol.MapBrowserEvent.EventType.POINTERDOWN ||
|
||||
type === ol.MapBrowserEvent.EventType.POINTERDRAG ||
|
||||
type === ol.MapBrowserEvent.EventType.POINTERUP);
|
||||
type === ol.MapBrowserEventType.POINTERDOWN ||
|
||||
type === ol.MapBrowserEventType.POINTERDRAG ||
|
||||
type === ol.MapBrowserEventType.POINTERUP);
|
||||
};
|
||||
|
||||
|
||||
@@ -123,10 +123,10 @@ ol.interaction.Pointer.prototype.updateTrackedPointers_ = function(mapBrowserEve
|
||||
if (this.isPointerDraggingEvent_(mapBrowserEvent)) {
|
||||
var event = mapBrowserEvent.pointerEvent;
|
||||
|
||||
if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.POINTERUP) {
|
||||
if (mapBrowserEvent.type == ol.MapBrowserEventType.POINTERUP) {
|
||||
delete this.trackedPointers_[event.pointerId];
|
||||
} else if (mapBrowserEvent.type ==
|
||||
ol.MapBrowserEvent.EventType.POINTERDOWN) {
|
||||
ol.MapBrowserEventType.POINTERDOWN) {
|
||||
this.trackedPointers_[event.pointerId] = event;
|
||||
} else if (event.pointerId in this.trackedPointers_) {
|
||||
// update only when there was a pointerdown event for this pointer
|
||||
@@ -184,17 +184,17 @@ ol.interaction.Pointer.handleEvent = function(mapBrowserEvent) {
|
||||
var stopEvent = false;
|
||||
this.updateTrackedPointers_(mapBrowserEvent);
|
||||
if (this.handlingDownUpSequence) {
|
||||
if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.POINTERDRAG) {
|
||||
if (mapBrowserEvent.type == ol.MapBrowserEventType.POINTERDRAG) {
|
||||
this.handleDragEvent_(mapBrowserEvent);
|
||||
} else if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.POINTERUP) {
|
||||
} else if (mapBrowserEvent.type == ol.MapBrowserEventType.POINTERUP) {
|
||||
this.handlingDownUpSequence = this.handleUpEvent_(mapBrowserEvent);
|
||||
}
|
||||
}
|
||||
if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.POINTERDOWN) {
|
||||
if (mapBrowserEvent.type == ol.MapBrowserEventType.POINTERDOWN) {
|
||||
var handled = this.handleDownEvent_(mapBrowserEvent);
|
||||
this.handlingDownUpSequence = handled;
|
||||
stopEvent = this.shouldStopEvent(handled);
|
||||
} else if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.POINTERMOVE) {
|
||||
} else if (mapBrowserEvent.type == ol.MapBrowserEventType.POINTERMOVE) {
|
||||
this.handleMoveEvent_(mapBrowserEvent);
|
||||
}
|
||||
return !stopEvent;
|
||||
|
||||
Reference in New Issue
Block a user