Rename _ol_MapBrowserEventType_ to MapBrowserEventType
This commit is contained in:
committed by
Frederic Junod
parent
465c248572
commit
039bde29cc
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
import {inherits} from './index.js';
|
import {inherits} from './index.js';
|
||||||
import _ol_has_ from './has.js';
|
import _ol_has_ from './has.js';
|
||||||
import _ol_MapBrowserEventType_ from './MapBrowserEventType.js';
|
import MapBrowserEventType from './MapBrowserEventType.js';
|
||||||
import _ol_MapBrowserPointerEvent_ from './MapBrowserPointerEvent.js';
|
import _ol_MapBrowserPointerEvent_ from './MapBrowserPointerEvent.js';
|
||||||
import _ol_events_ from './events.js';
|
import _ol_events_ from './events.js';
|
||||||
import _ol_events_EventTarget_ from './events/EventTarget.js';
|
import _ol_events_EventTarget_ from './events/EventTarget.js';
|
||||||
@@ -119,21 +119,21 @@ inherits(_ol_MapBrowserEventHandler_, _ol_events_EventTarget_);
|
|||||||
*/
|
*/
|
||||||
_ol_MapBrowserEventHandler_.prototype.emulateClick_ = function(pointerEvent) {
|
_ol_MapBrowserEventHandler_.prototype.emulateClick_ = function(pointerEvent) {
|
||||||
var newEvent = new _ol_MapBrowserPointerEvent_(
|
var newEvent = new _ol_MapBrowserPointerEvent_(
|
||||||
_ol_MapBrowserEventType_.CLICK, this.map_, pointerEvent);
|
MapBrowserEventType.CLICK, this.map_, pointerEvent);
|
||||||
this.dispatchEvent(newEvent);
|
this.dispatchEvent(newEvent);
|
||||||
if (this.clickTimeoutId_ !== 0) {
|
if (this.clickTimeoutId_ !== 0) {
|
||||||
// double-click
|
// double-click
|
||||||
clearTimeout(this.clickTimeoutId_);
|
clearTimeout(this.clickTimeoutId_);
|
||||||
this.clickTimeoutId_ = 0;
|
this.clickTimeoutId_ = 0;
|
||||||
newEvent = new _ol_MapBrowserPointerEvent_(
|
newEvent = new _ol_MapBrowserPointerEvent_(
|
||||||
_ol_MapBrowserEventType_.DBLCLICK, this.map_, pointerEvent);
|
MapBrowserEventType.DBLCLICK, this.map_, pointerEvent);
|
||||||
this.dispatchEvent(newEvent);
|
this.dispatchEvent(newEvent);
|
||||||
} else {
|
} else {
|
||||||
// click
|
// click
|
||||||
this.clickTimeoutId_ = setTimeout(function() {
|
this.clickTimeoutId_ = setTimeout(function() {
|
||||||
this.clickTimeoutId_ = 0;
|
this.clickTimeoutId_ = 0;
|
||||||
var newEvent = new _ol_MapBrowserPointerEvent_(
|
var newEvent = new _ol_MapBrowserPointerEvent_(
|
||||||
_ol_MapBrowserEventType_.SINGLECLICK, this.map_, pointerEvent);
|
MapBrowserEventType.SINGLECLICK, this.map_, pointerEvent);
|
||||||
this.dispatchEvent(newEvent);
|
this.dispatchEvent(newEvent);
|
||||||
}.bind(this), 250);
|
}.bind(this), 250);
|
||||||
}
|
}
|
||||||
@@ -149,10 +149,10 @@ _ol_MapBrowserEventHandler_.prototype.emulateClick_ = function(pointerEvent) {
|
|||||||
_ol_MapBrowserEventHandler_.prototype.updateActivePointers_ = function(pointerEvent) {
|
_ol_MapBrowserEventHandler_.prototype.updateActivePointers_ = function(pointerEvent) {
|
||||||
var event = pointerEvent;
|
var event = pointerEvent;
|
||||||
|
|
||||||
if (event.type == _ol_MapBrowserEventType_.POINTERUP ||
|
if (event.type == MapBrowserEventType.POINTERUP ||
|
||||||
event.type == _ol_MapBrowserEventType_.POINTERCANCEL) {
|
event.type == MapBrowserEventType.POINTERCANCEL) {
|
||||||
delete this.trackedTouches_[event.pointerId];
|
delete this.trackedTouches_[event.pointerId];
|
||||||
} else if (event.type == _ol_MapBrowserEventType_.POINTERDOWN) {
|
} else if (event.type == MapBrowserEventType.POINTERDOWN) {
|
||||||
this.trackedTouches_[event.pointerId] = true;
|
this.trackedTouches_[event.pointerId] = true;
|
||||||
}
|
}
|
||||||
this.activePointers_ = Object.keys(this.trackedTouches_).length;
|
this.activePointers_ = Object.keys(this.trackedTouches_).length;
|
||||||
@@ -166,7 +166,7 @@ _ol_MapBrowserEventHandler_.prototype.updateActivePointers_ = function(pointerEv
|
|||||||
_ol_MapBrowserEventHandler_.prototype.handlePointerUp_ = function(pointerEvent) {
|
_ol_MapBrowserEventHandler_.prototype.handlePointerUp_ = function(pointerEvent) {
|
||||||
this.updateActivePointers_(pointerEvent);
|
this.updateActivePointers_(pointerEvent);
|
||||||
var newEvent = new _ol_MapBrowserPointerEvent_(
|
var newEvent = new _ol_MapBrowserPointerEvent_(
|
||||||
_ol_MapBrowserEventType_.POINTERUP, this.map_, pointerEvent);
|
MapBrowserEventType.POINTERUP, this.map_, pointerEvent);
|
||||||
this.dispatchEvent(newEvent);
|
this.dispatchEvent(newEvent);
|
||||||
|
|
||||||
// We emulate click events on left mouse button click, touch contact, and pen
|
// We emulate click events on left mouse button click, touch contact, and pen
|
||||||
@@ -207,7 +207,7 @@ _ol_MapBrowserEventHandler_.prototype.isMouseActionButton_ = function(pointerEve
|
|||||||
_ol_MapBrowserEventHandler_.prototype.handlePointerDown_ = function(pointerEvent) {
|
_ol_MapBrowserEventHandler_.prototype.handlePointerDown_ = function(pointerEvent) {
|
||||||
this.updateActivePointers_(pointerEvent);
|
this.updateActivePointers_(pointerEvent);
|
||||||
var newEvent = new _ol_MapBrowserPointerEvent_(
|
var newEvent = new _ol_MapBrowserPointerEvent_(
|
||||||
_ol_MapBrowserEventType_.POINTERDOWN, this.map_, pointerEvent);
|
MapBrowserEventType.POINTERDOWN, this.map_, pointerEvent);
|
||||||
this.dispatchEvent(newEvent);
|
this.dispatchEvent(newEvent);
|
||||||
|
|
||||||
this.down_ = pointerEvent;
|
this.down_ = pointerEvent;
|
||||||
@@ -222,10 +222,10 @@ _ol_MapBrowserEventHandler_.prototype.handlePointerDown_ = function(pointerEvent
|
|||||||
|
|
||||||
this.dragListenerKeys_.push(
|
this.dragListenerKeys_.push(
|
||||||
_ol_events_.listen(this.documentPointerEventHandler_,
|
_ol_events_.listen(this.documentPointerEventHandler_,
|
||||||
_ol_MapBrowserEventType_.POINTERMOVE,
|
MapBrowserEventType.POINTERMOVE,
|
||||||
this.handlePointerMove_, this),
|
this.handlePointerMove_, this),
|
||||||
_ol_events_.listen(this.documentPointerEventHandler_,
|
_ol_events_.listen(this.documentPointerEventHandler_,
|
||||||
_ol_MapBrowserEventType_.POINTERUP,
|
MapBrowserEventType.POINTERUP,
|
||||||
this.handlePointerUp_, this),
|
this.handlePointerUp_, this),
|
||||||
/* Note that the listener for `pointercancel is set up on
|
/* Note that the listener for `pointercancel is set up on
|
||||||
* `pointerEventHandler_` and not `documentPointerEventHandler_` like
|
* `pointerEventHandler_` and not `documentPointerEventHandler_` like
|
||||||
@@ -241,7 +241,7 @@ _ol_MapBrowserEventHandler_.prototype.handlePointerDown_ = function(pointerEvent
|
|||||||
* only registered there.
|
* only registered there.
|
||||||
*/
|
*/
|
||||||
_ol_events_.listen(this.pointerEventHandler_,
|
_ol_events_.listen(this.pointerEventHandler_,
|
||||||
_ol_MapBrowserEventType_.POINTERCANCEL,
|
MapBrowserEventType.POINTERCANCEL,
|
||||||
this.handlePointerUp_, this)
|
this.handlePointerUp_, this)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -259,7 +259,7 @@ _ol_MapBrowserEventHandler_.prototype.handlePointerMove_ = function(pointerEvent
|
|||||||
if (this.isMoving_(pointerEvent)) {
|
if (this.isMoving_(pointerEvent)) {
|
||||||
this.dragging_ = true;
|
this.dragging_ = true;
|
||||||
var newEvent = new _ol_MapBrowserPointerEvent_(
|
var newEvent = new _ol_MapBrowserPointerEvent_(
|
||||||
_ol_MapBrowserEventType_.POINTERDRAG, this.map_, pointerEvent,
|
MapBrowserEventType.POINTERDRAG, this.map_, pointerEvent,
|
||||||
this.dragging_);
|
this.dragging_);
|
||||||
this.dispatchEvent(newEvent);
|
this.dispatchEvent(newEvent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import _ol_Collection_ from './Collection.js';
|
|||||||
import _ol_CollectionEventType_ from './CollectionEventType.js';
|
import _ol_CollectionEventType_ from './CollectionEventType.js';
|
||||||
import MapBrowserEvent from './MapBrowserEvent.js';
|
import MapBrowserEvent from './MapBrowserEvent.js';
|
||||||
import _ol_MapBrowserEventHandler_ from './MapBrowserEventHandler.js';
|
import _ol_MapBrowserEventHandler_ from './MapBrowserEventHandler.js';
|
||||||
import _ol_MapBrowserEventType_ from './MapBrowserEventType.js';
|
import MapBrowserEventType from './MapBrowserEventType.js';
|
||||||
import MapEvent from './MapEvent.js';
|
import MapEvent from './MapEvent.js';
|
||||||
import _ol_MapEventType_ from './MapEventType.js';
|
import _ol_MapEventType_ from './MapEventType.js';
|
||||||
import _ol_MapProperty_ from './MapProperty.js';
|
import _ol_MapProperty_ from './MapProperty.js';
|
||||||
@@ -173,7 +173,7 @@ var _ol_PluggableMap_ = function(options) {
|
|||||||
_ol_events_EventType_.MOUSEDOWN,
|
_ol_events_EventType_.MOUSEDOWN,
|
||||||
_ol_events_EventType_.TOUCHSTART,
|
_ol_events_EventType_.TOUCHSTART,
|
||||||
_ol_events_EventType_.MSPOINTERDOWN,
|
_ol_events_EventType_.MSPOINTERDOWN,
|
||||||
_ol_MapBrowserEventType_.POINTERDOWN,
|
MapBrowserEventType.POINTERDOWN,
|
||||||
_ol_events_EventType_.MOUSEWHEEL,
|
_ol_events_EventType_.MOUSEWHEEL,
|
||||||
_ol_events_EventType_.WHEEL
|
_ol_events_EventType_.WHEEL
|
||||||
];
|
];
|
||||||
@@ -188,8 +188,8 @@ var _ol_PluggableMap_ = function(options) {
|
|||||||
* @type {ol.MapBrowserEventHandler}
|
* @type {ol.MapBrowserEventHandler}
|
||||||
*/
|
*/
|
||||||
this.mapBrowserEventHandler_ = new _ol_MapBrowserEventHandler_(this, options.moveTolerance);
|
this.mapBrowserEventHandler_ = new _ol_MapBrowserEventHandler_(this, options.moveTolerance);
|
||||||
for (var key in _ol_MapBrowserEventType_) {
|
for (var key in MapBrowserEventType) {
|
||||||
_ol_events_.listen(this.mapBrowserEventHandler_, _ol_MapBrowserEventType_[key],
|
_ol_events_.listen(this.mapBrowserEventHandler_, MapBrowserEventType[key],
|
||||||
this.handleMapBrowserEvent, this);
|
this.handleMapBrowserEvent, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @module ol/events/condition
|
* @module ol/events/condition
|
||||||
*/
|
*/
|
||||||
import _ol_MapBrowserEventType_ from '../MapBrowserEventType.js';
|
import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||||
import _ol_asserts_ from '../asserts.js';
|
import _ol_asserts_ from '../asserts.js';
|
||||||
import {TRUE, FALSE} from '../functions.js';
|
import {TRUE, FALSE} from '../functions.js';
|
||||||
import _ol_has_ from '../has.js';
|
import _ol_has_ from '../has.js';
|
||||||
@@ -61,7 +61,7 @@ _ol_events_condition_.always = TRUE;
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_events_condition_.click = function(mapBrowserEvent) {
|
_ol_events_condition_.click = function(mapBrowserEvent) {
|
||||||
return mapBrowserEvent.type == _ol_MapBrowserEventType_.CLICK;
|
return mapBrowserEvent.type == MapBrowserEventType.CLICK;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ _ol_events_condition_.pointerMove = function(mapBrowserEvent) {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_events_condition_.singleClick = function(mapBrowserEvent) {
|
_ol_events_condition_.singleClick = function(mapBrowserEvent) {
|
||||||
return mapBrowserEvent.type == _ol_MapBrowserEventType_.SINGLECLICK;
|
return mapBrowserEvent.type == MapBrowserEventType.SINGLECLICK;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ _ol_events_condition_.singleClick = function(mapBrowserEvent) {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_events_condition_.doubleClick = function(mapBrowserEvent) {
|
_ol_events_condition_.doubleClick = function(mapBrowserEvent) {
|
||||||
return mapBrowserEvent.type == _ol_MapBrowserEventType_.DBLCLICK;
|
return mapBrowserEvent.type == MapBrowserEventType.DBLCLICK;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @module ol/interaction/DoubleClickZoom
|
* @module ol/interaction/DoubleClickZoom
|
||||||
*/
|
*/
|
||||||
import {inherits} from '../index.js';
|
import {inherits} from '../index.js';
|
||||||
import _ol_MapBrowserEventType_ from '../MapBrowserEventType.js';
|
import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||||
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
|
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -50,7 +50,7 @@ inherits(_ol_interaction_DoubleClickZoom_, _ol_interaction_Interaction_);
|
|||||||
_ol_interaction_DoubleClickZoom_.handleEvent = function(mapBrowserEvent) {
|
_ol_interaction_DoubleClickZoom_.handleEvent = function(mapBrowserEvent) {
|
||||||
var stopEvent = false;
|
var stopEvent = false;
|
||||||
var browserEvent = mapBrowserEvent.originalEvent;
|
var browserEvent = mapBrowserEvent.originalEvent;
|
||||||
if (mapBrowserEvent.type == _ol_MapBrowserEventType_.DBLCLICK) {
|
if (mapBrowserEvent.type == MapBrowserEventType.DBLCLICK) {
|
||||||
var map = mapBrowserEvent.map;
|
var map = mapBrowserEvent.map;
|
||||||
var anchor = mapBrowserEvent.coordinate;
|
var anchor = mapBrowserEvent.coordinate;
|
||||||
var delta = browserEvent.shiftKey ? -this.delta_ : this.delta_;
|
var delta = browserEvent.shiftKey ? -this.delta_ : this.delta_;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
import {inherits} from '../index.js';
|
import {inherits} from '../index.js';
|
||||||
import _ol_Feature_ from '../Feature.js';
|
import _ol_Feature_ from '../Feature.js';
|
||||||
import _ol_MapBrowserEventType_ from '../MapBrowserEventType.js';
|
import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||||
import _ol_Object_ from '../Object.js';
|
import _ol_Object_ from '../Object.js';
|
||||||
import _ol_coordinate_ from '../coordinate.js';
|
import _ol_coordinate_ from '../coordinate.js';
|
||||||
import _ol_events_ from '../events.js';
|
import _ol_events_ from '../events.js';
|
||||||
@@ -325,16 +325,16 @@ _ol_interaction_Draw_.handleEvent = function(event) {
|
|||||||
this.freehand_ = this.mode_ !== _ol_interaction_Draw_.Mode_.POINT && this.freehandCondition_(event);
|
this.freehand_ = this.mode_ !== _ol_interaction_Draw_.Mode_.POINT && this.freehandCondition_(event);
|
||||||
var pass = true;
|
var pass = true;
|
||||||
if (this.freehand_ &&
|
if (this.freehand_ &&
|
||||||
event.type === _ol_MapBrowserEventType_.POINTERDRAG &&
|
event.type === MapBrowserEventType.POINTERDRAG &&
|
||||||
this.sketchFeature_ !== null) {
|
this.sketchFeature_ !== null) {
|
||||||
this.addToDrawing_(event);
|
this.addToDrawing_(event);
|
||||||
pass = false;
|
pass = false;
|
||||||
} else if (this.freehand_ &&
|
} else if (this.freehand_ &&
|
||||||
event.type === _ol_MapBrowserEventType_.POINTERDOWN) {
|
event.type === MapBrowserEventType.POINTERDOWN) {
|
||||||
pass = false;
|
pass = false;
|
||||||
} else if (event.type === _ol_MapBrowserEventType_.POINTERMOVE) {
|
} else if (event.type === MapBrowserEventType.POINTERMOVE) {
|
||||||
pass = this.handlePointerMove_(event);
|
pass = this.handlePointerMove_(event);
|
||||||
} else if (event.type === _ol_MapBrowserEventType_.DBLCLICK) {
|
} else if (event.type === MapBrowserEventType.DBLCLICK) {
|
||||||
pass = false;
|
pass = false;
|
||||||
}
|
}
|
||||||
return _ol_interaction_Pointer_.handleEvent.call(this, event) && pass;
|
return _ol_interaction_Pointer_.handleEvent.call(this, event) && pass;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
import {inherits} from '../index.js';
|
import {inherits} from '../index.js';
|
||||||
import _ol_Feature_ from '../Feature.js';
|
import _ol_Feature_ from '../Feature.js';
|
||||||
import _ol_MapBrowserEventType_ from '../MapBrowserEventType.js';
|
import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||||
import _ol_MapBrowserPointerEvent_ from '../MapBrowserPointerEvent.js';
|
import _ol_MapBrowserPointerEvent_ from '../MapBrowserPointerEvent.js';
|
||||||
import _ol_coordinate_ from '../coordinate.js';
|
import _ol_coordinate_ from '../coordinate.js';
|
||||||
import Event from '../events/Event.js';
|
import Event from '../events/Event.js';
|
||||||
@@ -136,7 +136,7 @@ _ol_interaction_Extent_.handleEvent_ = function(mapBrowserEvent) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//display pointer (if not dragging)
|
//display pointer (if not dragging)
|
||||||
if (mapBrowserEvent.type == _ol_MapBrowserEventType_.POINTERMOVE && !this.handlingDownUpSequence) {
|
if (mapBrowserEvent.type == MapBrowserEventType.POINTERMOVE && !this.handlingDownUpSequence) {
|
||||||
this.handlePointerMove_(mapBrowserEvent);
|
this.handlePointerMove_(mapBrowserEvent);
|
||||||
}
|
}
|
||||||
//call pointer to determine up/down/drag
|
//call pointer to determine up/down/drag
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {getUid, inherits} from '../index.js';
|
|||||||
import _ol_Collection_ from '../Collection.js';
|
import _ol_Collection_ from '../Collection.js';
|
||||||
import _ol_CollectionEventType_ from '../CollectionEventType.js';
|
import _ol_CollectionEventType_ from '../CollectionEventType.js';
|
||||||
import _ol_Feature_ from '../Feature.js';
|
import _ol_Feature_ from '../Feature.js';
|
||||||
import _ol_MapBrowserEventType_ from '../MapBrowserEventType.js';
|
import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||||
import _ol_MapBrowserPointerEvent_ from '../MapBrowserPointerEvent.js';
|
import _ol_MapBrowserPointerEvent_ from '../MapBrowserPointerEvent.js';
|
||||||
import _ol_array_ from '../array.js';
|
import _ol_array_ from '../array.js';
|
||||||
import _ol_coordinate_ from '../coordinate.js';
|
import _ol_coordinate_ from '../coordinate.js';
|
||||||
@@ -806,12 +806,12 @@ _ol_interaction_Modify_.handleEvent = function(mapBrowserEvent) {
|
|||||||
|
|
||||||
var handled;
|
var handled;
|
||||||
if (!mapBrowserEvent.map.getView().getInteracting() &&
|
if (!mapBrowserEvent.map.getView().getInteracting() &&
|
||||||
mapBrowserEvent.type == _ol_MapBrowserEventType_.POINTERMOVE &&
|
mapBrowserEvent.type == MapBrowserEventType.POINTERMOVE &&
|
||||||
!this.handlingDownUpSequence) {
|
!this.handlingDownUpSequence) {
|
||||||
this.handlePointerMove_(mapBrowserEvent);
|
this.handlePointerMove_(mapBrowserEvent);
|
||||||
}
|
}
|
||||||
if (this.vertexFeature_ && this.deleteCondition_(mapBrowserEvent)) {
|
if (this.vertexFeature_ && this.deleteCondition_(mapBrowserEvent)) {
|
||||||
if (mapBrowserEvent.type != _ol_MapBrowserEventType_.SINGLECLICK ||
|
if (mapBrowserEvent.type != MapBrowserEventType.SINGLECLICK ||
|
||||||
!this.ignoreNextSingleClick_) {
|
!this.ignoreNextSingleClick_) {
|
||||||
handled = this.removePoint();
|
handled = this.removePoint();
|
||||||
} else {
|
} else {
|
||||||
@@ -819,7 +819,7 @@ _ol_interaction_Modify_.handleEvent = function(mapBrowserEvent) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapBrowserEvent.type == _ol_MapBrowserEventType_.SINGLECLICK) {
|
if (mapBrowserEvent.type == MapBrowserEventType.SINGLECLICK) {
|
||||||
this.ignoreNextSingleClick_ = false;
|
this.ignoreNextSingleClick_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1026,7 +1026,7 @@ _ol_interaction_Modify_.prototype.insertVertex_ = function(segmentData, vertex)
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Modify_.prototype.removePoint = function() {
|
_ol_interaction_Modify_.prototype.removePoint = function() {
|
||||||
if (this.lastPointerEvent_ && this.lastPointerEvent_.type != _ol_MapBrowserEventType_.POINTERDRAG) {
|
if (this.lastPointerEvent_ && this.lastPointerEvent_.type != MapBrowserEventType.POINTERDRAG) {
|
||||||
var evt = this.lastPointerEvent_;
|
var evt = this.lastPointerEvent_;
|
||||||
this.willModifyFeatures_(evt);
|
this.willModifyFeatures_(evt);
|
||||||
this.removeVertex_();
|
this.removeVertex_();
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
import {inherits, nullFunction} from '../index.js';
|
import {inherits, nullFunction} from '../index.js';
|
||||||
import {FALSE} from '../functions.js';
|
import {FALSE} from '../functions.js';
|
||||||
import _ol_MapBrowserEventType_ from '../MapBrowserEventType.js';
|
import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||||
import _ol_MapBrowserPointerEvent_ from '../MapBrowserPointerEvent.js';
|
import _ol_MapBrowserPointerEvent_ from '../MapBrowserPointerEvent.js';
|
||||||
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
|
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
|
||||||
import _ol_obj_ from '../obj.js';
|
import _ol_obj_ from '../obj.js';
|
||||||
@@ -109,9 +109,9 @@ _ol_interaction_Pointer_.centroid = function(pointerEvents) {
|
|||||||
*/
|
*/
|
||||||
_ol_interaction_Pointer_.prototype.isPointerDraggingEvent_ = function(mapBrowserEvent) {
|
_ol_interaction_Pointer_.prototype.isPointerDraggingEvent_ = function(mapBrowserEvent) {
|
||||||
var type = mapBrowserEvent.type;
|
var type = mapBrowserEvent.type;
|
||||||
return type === _ol_MapBrowserEventType_.POINTERDOWN ||
|
return type === MapBrowserEventType.POINTERDOWN ||
|
||||||
type === _ol_MapBrowserEventType_.POINTERDRAG ||
|
type === MapBrowserEventType.POINTERDRAG ||
|
||||||
type === _ol_MapBrowserEventType_.POINTERUP;
|
type === MapBrowserEventType.POINTERUP;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -124,10 +124,10 @@ _ol_interaction_Pointer_.prototype.updateTrackedPointers_ = function(mapBrowserE
|
|||||||
var event = mapBrowserEvent.pointerEvent;
|
var event = mapBrowserEvent.pointerEvent;
|
||||||
|
|
||||||
var id = event.pointerId.toString();
|
var id = event.pointerId.toString();
|
||||||
if (mapBrowserEvent.type == _ol_MapBrowserEventType_.POINTERUP) {
|
if (mapBrowserEvent.type == MapBrowserEventType.POINTERUP) {
|
||||||
delete this.trackedPointers_[id];
|
delete this.trackedPointers_[id];
|
||||||
} else if (mapBrowserEvent.type ==
|
} else if (mapBrowserEvent.type ==
|
||||||
_ol_MapBrowserEventType_.POINTERDOWN) {
|
MapBrowserEventType.POINTERDOWN) {
|
||||||
this.trackedPointers_[id] = event;
|
this.trackedPointers_[id] = event;
|
||||||
} else if (id in this.trackedPointers_) {
|
} else if (id in this.trackedPointers_) {
|
||||||
// update only when there was a pointerdown event for this pointer
|
// update only when there was a pointerdown event for this pointer
|
||||||
@@ -185,18 +185,18 @@ _ol_interaction_Pointer_.handleEvent = function(mapBrowserEvent) {
|
|||||||
var stopEvent = false;
|
var stopEvent = false;
|
||||||
this.updateTrackedPointers_(mapBrowserEvent);
|
this.updateTrackedPointers_(mapBrowserEvent);
|
||||||
if (this.handlingDownUpSequence) {
|
if (this.handlingDownUpSequence) {
|
||||||
if (mapBrowserEvent.type == _ol_MapBrowserEventType_.POINTERDRAG) {
|
if (mapBrowserEvent.type == MapBrowserEventType.POINTERDRAG) {
|
||||||
this.handleDragEvent_(mapBrowserEvent);
|
this.handleDragEvent_(mapBrowserEvent);
|
||||||
} else if (mapBrowserEvent.type == _ol_MapBrowserEventType_.POINTERUP) {
|
} else if (mapBrowserEvent.type == MapBrowserEventType.POINTERUP) {
|
||||||
var handledUp = this.handleUpEvent_(mapBrowserEvent);
|
var handledUp = this.handleUpEvent_(mapBrowserEvent);
|
||||||
this.handlingDownUpSequence = handledUp && this.targetPointers.length > 0;
|
this.handlingDownUpSequence = handledUp && this.targetPointers.length > 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mapBrowserEvent.type == _ol_MapBrowserEventType_.POINTERDOWN) {
|
if (mapBrowserEvent.type == MapBrowserEventType.POINTERDOWN) {
|
||||||
var handled = this.handleDownEvent_(mapBrowserEvent);
|
var handled = this.handleDownEvent_(mapBrowserEvent);
|
||||||
this.handlingDownUpSequence = handled;
|
this.handlingDownUpSequence = handled;
|
||||||
stopEvent = this.shouldStopEvent(handled);
|
stopEvent = this.shouldStopEvent(handled);
|
||||||
} else if (mapBrowserEvent.type == _ol_MapBrowserEventType_.POINTERMOVE) {
|
} else if (mapBrowserEvent.type == MapBrowserEventType.POINTERMOVE) {
|
||||||
this.handleMoveEvent_(mapBrowserEvent);
|
this.handleMoveEvent_(mapBrowserEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import _ol_Collection_ from '../../../../src/ol/Collection.js';
|
import _ol_Collection_ from '../../../../src/ol/Collection.js';
|
||||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||||
import _ol_Map_ from '../../../../src/ol/Map.js';
|
import _ol_Map_ from '../../../../src/ol/Map.js';
|
||||||
import _ol_MapBrowserEventType_ from '../../../../src/ol/MapBrowserEventType.js';
|
import MapBrowserEventType from '../../../../src/ol/MapBrowserEventType.js';
|
||||||
import _ol_MapBrowserPointerEvent_ from '../../../../src/ol/MapBrowserPointerEvent.js';
|
import _ol_MapBrowserPointerEvent_ from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||||
import _ol_View_ from '../../../../src/ol/View.js';
|
import _ol_View_ from '../../../../src/ol/View.js';
|
||||||
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
@@ -148,7 +148,7 @@ describe('ol.interaction.Select', function() {
|
|||||||
});
|
});
|
||||||
select.on('select', listenerSpy);
|
select.on('select', listenerSpy);
|
||||||
|
|
||||||
simulateEvent(_ol_MapBrowserEventType_.SINGLECLICK, -10, -10);
|
simulateEvent(MapBrowserEventType.SINGLECLICK, -10, -10);
|
||||||
|
|
||||||
expect(listenerSpy.callCount).to.be(0);
|
expect(listenerSpy.callCount).to.be(0);
|
||||||
|
|
||||||
@@ -162,8 +162,8 @@ describe('ol.interaction.Select', function() {
|
|||||||
});
|
});
|
||||||
select.on('select', listenerSpy);
|
select.on('select', listenerSpy);
|
||||||
|
|
||||||
simulateEvent(_ol_MapBrowserEventType_.SINGLECLICK, 10, -20);
|
simulateEvent(MapBrowserEventType.SINGLECLICK, 10, -20);
|
||||||
simulateEvent(_ol_MapBrowserEventType_.SINGLECLICK, 9, -21);
|
simulateEvent(MapBrowserEventType.SINGLECLICK, 9, -21);
|
||||||
|
|
||||||
expect(listenerSpy.callCount).to.be(1);
|
expect(listenerSpy.callCount).to.be(1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user