Rename _ol_MapBrowserPointEvent_ to MapBrowserPointerEvent
This commit is contained in:
committed by
Frederic Junod
parent
039bde29cc
commit
ec64789940
@@ -4,7 +4,7 @@
|
||||
import {inherits} from './index.js';
|
||||
import _ol_has_ from './has.js';
|
||||
import MapBrowserEventType from './MapBrowserEventType.js';
|
||||
import _ol_MapBrowserPointerEvent_ from './MapBrowserPointerEvent.js';
|
||||
import MapBrowserPointerEvent from './MapBrowserPointerEvent.js';
|
||||
import _ol_events_ from './events.js';
|
||||
import _ol_events_EventTarget_ from './events/EventTarget.js';
|
||||
import _ol_pointer_EventType_ from './pointer/EventType.js';
|
||||
@@ -118,21 +118,21 @@ inherits(_ol_MapBrowserEventHandler_, _ol_events_EventTarget_);
|
||||
* @private
|
||||
*/
|
||||
_ol_MapBrowserEventHandler_.prototype.emulateClick_ = function(pointerEvent) {
|
||||
var newEvent = new _ol_MapBrowserPointerEvent_(
|
||||
var newEvent = new MapBrowserPointerEvent(
|
||||
MapBrowserEventType.CLICK, this.map_, pointerEvent);
|
||||
this.dispatchEvent(newEvent);
|
||||
if (this.clickTimeoutId_ !== 0) {
|
||||
// double-click
|
||||
clearTimeout(this.clickTimeoutId_);
|
||||
this.clickTimeoutId_ = 0;
|
||||
newEvent = new _ol_MapBrowserPointerEvent_(
|
||||
newEvent = new MapBrowserPointerEvent(
|
||||
MapBrowserEventType.DBLCLICK, this.map_, pointerEvent);
|
||||
this.dispatchEvent(newEvent);
|
||||
} else {
|
||||
// click
|
||||
this.clickTimeoutId_ = setTimeout(function() {
|
||||
this.clickTimeoutId_ = 0;
|
||||
var newEvent = new _ol_MapBrowserPointerEvent_(
|
||||
var newEvent = new MapBrowserPointerEvent(
|
||||
MapBrowserEventType.SINGLECLICK, this.map_, pointerEvent);
|
||||
this.dispatchEvent(newEvent);
|
||||
}.bind(this), 250);
|
||||
@@ -165,7 +165,7 @@ _ol_MapBrowserEventHandler_.prototype.updateActivePointers_ = function(pointerEv
|
||||
*/
|
||||
_ol_MapBrowserEventHandler_.prototype.handlePointerUp_ = function(pointerEvent) {
|
||||
this.updateActivePointers_(pointerEvent);
|
||||
var newEvent = new _ol_MapBrowserPointerEvent_(
|
||||
var newEvent = new MapBrowserPointerEvent(
|
||||
MapBrowserEventType.POINTERUP, this.map_, pointerEvent);
|
||||
this.dispatchEvent(newEvent);
|
||||
|
||||
@@ -206,7 +206,7 @@ _ol_MapBrowserEventHandler_.prototype.isMouseActionButton_ = function(pointerEve
|
||||
*/
|
||||
_ol_MapBrowserEventHandler_.prototype.handlePointerDown_ = function(pointerEvent) {
|
||||
this.updateActivePointers_(pointerEvent);
|
||||
var newEvent = new _ol_MapBrowserPointerEvent_(
|
||||
var newEvent = new MapBrowserPointerEvent(
|
||||
MapBrowserEventType.POINTERDOWN, this.map_, pointerEvent);
|
||||
this.dispatchEvent(newEvent);
|
||||
|
||||
@@ -258,7 +258,7 @@ _ol_MapBrowserEventHandler_.prototype.handlePointerMove_ = function(pointerEvent
|
||||
// moved a significant distance.
|
||||
if (this.isMoving_(pointerEvent)) {
|
||||
this.dragging_ = true;
|
||||
var newEvent = new _ol_MapBrowserPointerEvent_(
|
||||
var newEvent = new MapBrowserPointerEvent(
|
||||
MapBrowserEventType.POINTERDRAG, this.map_, pointerEvent,
|
||||
this.dragging_);
|
||||
this.dispatchEvent(newEvent);
|
||||
@@ -280,7 +280,7 @@ _ol_MapBrowserEventHandler_.prototype.handlePointerMove_ = function(pointerEvent
|
||||
*/
|
||||
_ol_MapBrowserEventHandler_.prototype.relayEvent_ = function(pointerEvent) {
|
||||
var dragging = !!(this.down_ && this.isMoving_(pointerEvent));
|
||||
this.dispatchEvent(new _ol_MapBrowserPointerEvent_(
|
||||
this.dispatchEvent(new MapBrowserPointerEvent(
|
||||
pointerEvent.type, this.map_, pointerEvent, dragging));
|
||||
};
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import MapBrowserEvent from './MapBrowserEvent.js';
|
||||
* @param {boolean=} opt_dragging Is the map currently being dragged?
|
||||
* @param {?olx.FrameState=} opt_frameState Frame state.
|
||||
*/
|
||||
var _ol_MapBrowserPointerEvent_ = function(type, map, pointerEvent, opt_dragging,
|
||||
var MapBrowserPointerEvent = function(type, map, pointerEvent, opt_dragging,
|
||||
opt_frameState) {
|
||||
|
||||
MapBrowserEvent.call(this, type, map, pointerEvent.originalEvent, opt_dragging,
|
||||
@@ -27,5 +27,5 @@ var _ol_MapBrowserPointerEvent_ = function(type, map, pointerEvent, opt_dragging
|
||||
|
||||
};
|
||||
|
||||
inherits(_ol_MapBrowserPointerEvent_, MapBrowserEvent);
|
||||
export default _ol_MapBrowserPointerEvent_;
|
||||
inherits(MapBrowserPointerEvent, MapBrowserEvent);
|
||||
export default MapBrowserPointerEvent;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Feature_ from '../Feature.js';
|
||||
import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||
import _ol_MapBrowserPointerEvent_ from '../MapBrowserPointerEvent.js';
|
||||
import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js';
|
||||
import _ol_coordinate_ from '../coordinate.js';
|
||||
import Event from '../events/Event.js';
|
||||
import {boundingExtent, getArea} from '../extent.js';
|
||||
@@ -132,7 +132,7 @@ inherits(_ol_interaction_Extent_, _ol_interaction_Pointer_);
|
||||
* @private
|
||||
*/
|
||||
_ol_interaction_Extent_.handleEvent_ = function(mapBrowserEvent) {
|
||||
if (!(mapBrowserEvent instanceof _ol_MapBrowserPointerEvent_)) {
|
||||
if (!(mapBrowserEvent instanceof MapBrowserPointerEvent)) {
|
||||
return true;
|
||||
}
|
||||
//display pointer (if not dragging)
|
||||
|
||||
@@ -6,7 +6,7 @@ import _ol_Collection_ from '../Collection.js';
|
||||
import _ol_CollectionEventType_ from '../CollectionEventType.js';
|
||||
import _ol_Feature_ from '../Feature.js';
|
||||
import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||
import _ol_MapBrowserPointerEvent_ from '../MapBrowserPointerEvent.js';
|
||||
import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js';
|
||||
import _ol_array_ from '../array.js';
|
||||
import _ol_coordinate_ from '../coordinate.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
@@ -799,7 +799,7 @@ _ol_interaction_Modify_.handleUpEvent_ = function(evt) {
|
||||
* @api
|
||||
*/
|
||||
_ol_interaction_Modify_.handleEvent = function(mapBrowserEvent) {
|
||||
if (!(mapBrowserEvent instanceof _ol_MapBrowserPointerEvent_)) {
|
||||
if (!(mapBrowserEvent instanceof MapBrowserPointerEvent)) {
|
||||
return true;
|
||||
}
|
||||
this.lastPointerEvent_ = mapBrowserEvent;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import {inherits, nullFunction} from '../index.js';
|
||||
import {FALSE} from '../functions.js';
|
||||
import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||
import _ol_MapBrowserPointerEvent_ from '../MapBrowserPointerEvent.js';
|
||||
import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js';
|
||||
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
|
||||
@@ -178,7 +178,7 @@ _ol_interaction_Pointer_.handleMoveEvent = nullFunction;
|
||||
* @api
|
||||
*/
|
||||
_ol_interaction_Pointer_.handleEvent = function(mapBrowserEvent) {
|
||||
if (!(mapBrowserEvent instanceof _ol_MapBrowserPointerEvent_)) {
|
||||
if (!(mapBrowserEvent instanceof MapBrowserPointerEvent)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import _ol_Map_ from '../../../../src/ol/Map.js';
|
||||
import _ol_MapBrowserPointerEvent_ from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
import _ol_interaction_DragRotateAndZoom_ from '../../../../src/ol/interaction/DragRotateAndZoom.js';
|
||||
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js';
|
||||
@@ -58,7 +58,7 @@ describe('ol.interaction.DragRotateAndZoom', function() {
|
||||
});
|
||||
|
||||
it('does not rotate when rotation is disabled on the view', function() {
|
||||
var event = new _ol_MapBrowserPointerEvent_('pointermove', map,
|
||||
var event = new MapBrowserPointerEvent('pointermove', map,
|
||||
new _ol_pointer_PointerEvent_('pointermove', {clientX: 20, clientY: 10}, {pointerType: 'mouse'}),
|
||||
true);
|
||||
interaction.lastAngle_ = Math.PI;
|
||||
@@ -72,7 +72,7 @@ describe('ol.interaction.DragRotateAndZoom', function() {
|
||||
resolution: 1,
|
||||
enableRotation: false
|
||||
}));
|
||||
event = new _ol_MapBrowserPointerEvent_('pointermove', map,
|
||||
event = new MapBrowserPointerEvent('pointermove', map,
|
||||
new _ol_pointer_PointerEvent_('pointermove', {clientX: 24, clientY: 16}, {pointerType: 'mouse'}),
|
||||
true);
|
||||
interaction.handleDragEvent_(event);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import _ol_Map_ from '../../../../src/ol/Map.js';
|
||||
import _ol_MapBrowserPointerEvent_ from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
import _ol_array_ from '../../../../src/ol/array.js';
|
||||
import _ol_events_ from '../../../../src/ol/events.js';
|
||||
@@ -73,7 +73,7 @@ describe('ol.interaction.Draw', function() {
|
||||
clientY: position.top + y + height / 2,
|
||||
shiftKey: shiftKey
|
||||
});
|
||||
map.handleMapBrowserEvent(new _ol_MapBrowserPointerEvent_(type, map, event));
|
||||
map.handleMapBrowserEvent(new MapBrowserPointerEvent(type, map, event));
|
||||
}
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import _ol_Map_ from '../../../../src/ol/Map.js';
|
||||
import _ol_MapBrowserPointerEvent_ from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
import _ol_interaction_Extent_ from '../../../../src/ol/interaction/Extent.js';
|
||||
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
|
||||
@@ -57,7 +57,7 @@ describe('ol.interaction.Extent', function() {
|
||||
clientY: position.top - y + height / 2,
|
||||
shiftKey: shiftKey
|
||||
});
|
||||
var event = new _ol_MapBrowserPointerEvent_(type, map, pointerEvent);
|
||||
var event = new MapBrowserPointerEvent(type, map, pointerEvent);
|
||||
event.pointerEvent.pointerId = 1;
|
||||
map.handleMapBrowserEvent(event);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import _ol_Collection_ from '../../../../src/ol/Collection.js';
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import _ol_Map_ from '../../../../src/ol/Map.js';
|
||||
import _ol_MapBrowserPointerEvent_ from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
import _ol_events_ from '../../../../src/ol/events.js';
|
||||
import _ol_events_condition_ from '../../../../src/ol/events/condition.js';
|
||||
@@ -91,7 +91,7 @@ describe('ol.interaction.Modify', function() {
|
||||
button: button,
|
||||
isPrimary: true
|
||||
});
|
||||
var event = new _ol_MapBrowserPointerEvent_(type, map, pointerEvent);
|
||||
var event = new MapBrowserPointerEvent(type, map, pointerEvent);
|
||||
event.pointerEvent.pointerId = 1;
|
||||
map.handleMapBrowserEvent(event);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import _ol_Collection_ from '../../../../src/ol/Collection.js';
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import _ol_Map_ from '../../../../src/ol/Map.js';
|
||||
import MapBrowserEventType from '../../../../src/ol/MapBrowserEventType.js';
|
||||
import _ol_MapBrowserPointerEvent_ from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js';
|
||||
@@ -97,7 +97,7 @@ describe('ol.interaction.Select', function() {
|
||||
clientY: position.top + y + height / 2,
|
||||
shiftKey: shiftKey
|
||||
});
|
||||
map.handleMapBrowserEvent(new _ol_MapBrowserPointerEvent_(type, map, event));
|
||||
map.handleMapBrowserEvent(new MapBrowserPointerEvent(type, map, event));
|
||||
}
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import _ol_Collection_ from '../../../../src/ol/Collection.js';
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import _ol_Map_ from '../../../../src/ol/Map.js';
|
||||
import _ol_MapBrowserPointerEvent_ from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
import Point from '../../../../src/ol/geom/Point.js';
|
||||
import _ol_interaction_Translate_ from '../../../../src/ol/interaction/Translate.js';
|
||||
@@ -66,7 +66,7 @@ describe('ol.interaction.Translate', function() {
|
||||
// calculated in case body has top < 0 (test runner with small window)
|
||||
var position = viewport.getBoundingClientRect();
|
||||
var shiftKey = opt_shiftKey !== undefined ? opt_shiftKey : false;
|
||||
var event = new _ol_MapBrowserPointerEvent_(type, map,
|
||||
var event = new MapBrowserPointerEvent(type, map,
|
||||
new _ol_pointer_PointerEvent_(type, {
|
||||
clientX: position.left + x + width / 2,
|
||||
clientY: position.top + y + height / 2,
|
||||
|
||||
Reference in New Issue
Block a user