Get rid of MapBrowserPointerEvent
This commit is contained in:
@@ -12,7 +12,7 @@ class MapBrowserEvent extends MapEvent {
|
|||||||
/**
|
/**
|
||||||
* @param {string} type Event type.
|
* @param {string} type Event type.
|
||||||
* @param {import("./PluggableMap.js").default} map Map.
|
* @param {import("./PluggableMap.js").default} map Map.
|
||||||
* @param {Event} browserEvent Browser event.
|
* @param {PointerEvent} browserEvent Browser event.
|
||||||
* @param {boolean=} opt_dragging Is the map currently being dragged?
|
* @param {boolean=} opt_dragging Is the map currently being dragged?
|
||||||
* @param {?import("./PluggableMap.js").FrameState=} opt_frameState Frame state.
|
* @param {?import("./PluggableMap.js").FrameState=} opt_frameState Frame state.
|
||||||
*/
|
*/
|
||||||
@@ -22,7 +22,7 @@ class MapBrowserEvent extends MapEvent {
|
|||||||
/**
|
/**
|
||||||
* The original browser event.
|
* The original browser event.
|
||||||
* @const
|
* @const
|
||||||
* @type {Event}
|
* @type {PointerEvent}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
this.originalEvent = browserEvent;
|
this.originalEvent = browserEvent;
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
import 'elm-pep';
|
import 'elm-pep';
|
||||||
import EventTarget from './events/Target.js';
|
import EventTarget from './events/Target.js';
|
||||||
import EventType from './events/EventType.js';
|
import EventType from './events/EventType.js';
|
||||||
|
import MapBrowserEvent from './MapBrowserEvent.js';
|
||||||
import MapBrowserEventType from './MapBrowserEventType.js';
|
import MapBrowserEventType from './MapBrowserEventType.js';
|
||||||
import MapBrowserPointerEvent from './MapBrowserPointerEvent.js';
|
|
||||||
import PointerEventType from './pointer/EventType.js';
|
import PointerEventType from './pointer/EventType.js';
|
||||||
import {DEVICE_PIXEL_RATIO, PASSIVE_EVENT_LISTENERS} from './has.js';
|
import {DEVICE_PIXEL_RATIO, PASSIVE_EVENT_LISTENERS} from './has.js';
|
||||||
import {listen, unlistenByKey} from './events.js';
|
import {listen, unlistenByKey} from './events.js';
|
||||||
@@ -122,7 +122,7 @@ class MapBrowserEventHandler extends EventTarget {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
emulateClick_(pointerEvent) {
|
emulateClick_(pointerEvent) {
|
||||||
let newEvent = new MapBrowserPointerEvent(
|
let newEvent = new MapBrowserEvent(
|
||||||
MapBrowserEventType.CLICK,
|
MapBrowserEventType.CLICK,
|
||||||
this.map_,
|
this.map_,
|
||||||
pointerEvent
|
pointerEvent
|
||||||
@@ -132,7 +132,7 @@ class MapBrowserEventHandler extends EventTarget {
|
|||||||
// double-click
|
// double-click
|
||||||
clearTimeout(this.clickTimeoutId_);
|
clearTimeout(this.clickTimeoutId_);
|
||||||
this.clickTimeoutId_ = undefined;
|
this.clickTimeoutId_ = undefined;
|
||||||
newEvent = new MapBrowserPointerEvent(
|
newEvent = new MapBrowserEvent(
|
||||||
MapBrowserEventType.DBLCLICK,
|
MapBrowserEventType.DBLCLICK,
|
||||||
this.map_,
|
this.map_,
|
||||||
pointerEvent
|
pointerEvent
|
||||||
@@ -143,7 +143,7 @@ class MapBrowserEventHandler extends EventTarget {
|
|||||||
this.clickTimeoutId_ = setTimeout(
|
this.clickTimeoutId_ = setTimeout(
|
||||||
function () {
|
function () {
|
||||||
this.clickTimeoutId_ = undefined;
|
this.clickTimeoutId_ = undefined;
|
||||||
const newEvent = new MapBrowserPointerEvent(
|
const newEvent = new MapBrowserEvent(
|
||||||
MapBrowserEventType.SINGLECLICK,
|
MapBrowserEventType.SINGLECLICK,
|
||||||
this.map_,
|
this.map_,
|
||||||
pointerEvent
|
pointerEvent
|
||||||
@@ -183,7 +183,7 @@ class MapBrowserEventHandler extends EventTarget {
|
|||||||
*/
|
*/
|
||||||
handlePointerUp_(pointerEvent) {
|
handlePointerUp_(pointerEvent) {
|
||||||
this.updateActivePointers_(pointerEvent);
|
this.updateActivePointers_(pointerEvent);
|
||||||
const newEvent = new MapBrowserPointerEvent(
|
const newEvent = new MapBrowserEvent(
|
||||||
MapBrowserEventType.POINTERUP,
|
MapBrowserEventType.POINTERUP,
|
||||||
this.map_,
|
this.map_,
|
||||||
pointerEvent
|
pointerEvent
|
||||||
@@ -229,7 +229,7 @@ class MapBrowserEventHandler extends EventTarget {
|
|||||||
*/
|
*/
|
||||||
handlePointerDown_(pointerEvent) {
|
handlePointerDown_(pointerEvent) {
|
||||||
this.updateActivePointers_(pointerEvent);
|
this.updateActivePointers_(pointerEvent);
|
||||||
const newEvent = new MapBrowserPointerEvent(
|
const newEvent = new MapBrowserEvent(
|
||||||
MapBrowserEventType.POINTERDOWN,
|
MapBrowserEventType.POINTERDOWN,
|
||||||
this.map_,
|
this.map_,
|
||||||
pointerEvent
|
pointerEvent
|
||||||
@@ -286,7 +286,7 @@ class MapBrowserEventHandler extends EventTarget {
|
|||||||
// moved a significant distance.
|
// moved a significant distance.
|
||||||
if (this.isMoving_(pointerEvent)) {
|
if (this.isMoving_(pointerEvent)) {
|
||||||
this.dragging_ = true;
|
this.dragging_ = true;
|
||||||
const newEvent = new MapBrowserPointerEvent(
|
const newEvent = new MapBrowserEvent(
|
||||||
MapBrowserEventType.POINTERDRAG,
|
MapBrowserEventType.POINTERDRAG,
|
||||||
this.map_,
|
this.map_,
|
||||||
pointerEvent,
|
pointerEvent,
|
||||||
@@ -298,7 +298,7 @@ class MapBrowserEventHandler extends EventTarget {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrap and relay a pointer event. Note that this requires that the type
|
* Wrap and relay a pointer event. Note that this requires that the type
|
||||||
* string for the MapBrowserPointerEvent matches the PointerEvent type.
|
* string for the MapBrowserEvent matches the PointerEvent type.
|
||||||
* @param {PointerEvent} pointerEvent Pointer
|
* @param {PointerEvent} pointerEvent Pointer
|
||||||
* event.
|
* event.
|
||||||
* @private
|
* @private
|
||||||
@@ -307,12 +307,7 @@ class MapBrowserEventHandler extends EventTarget {
|
|||||||
this.originalPointerMoveEvent_ = pointerEvent;
|
this.originalPointerMoveEvent_ = pointerEvent;
|
||||||
const dragging = !!(this.down_ && this.isMoving_(pointerEvent));
|
const dragging = !!(this.down_ && this.isMoving_(pointerEvent));
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(
|
||||||
new MapBrowserPointerEvent(
|
new MapBrowserEvent(pointerEvent.type, this.map_, pointerEvent, dragging)
|
||||||
pointerEvent.type,
|
|
||||||
this.map_,
|
|
||||||
pointerEvent,
|
|
||||||
dragging
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
/**
|
|
||||||
* @module ol/MapBrowserPointerEvent
|
|
||||||
*/
|
|
||||||
import MapBrowserEvent from './MapBrowserEvent.js';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @classdesc
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
class MapBrowserPointerEvent extends MapBrowserEvent {
|
|
||||||
/**
|
|
||||||
* @param {string} type Event type.
|
|
||||||
* @param {import("./PluggableMap.js").default} map Map.
|
|
||||||
* @param {PointerEvent} pointerEvent Pointer event.
|
|
||||||
* @param {boolean=} opt_dragging Is the map currently being dragged?
|
|
||||||
* @param {?import("./PluggableMap.js").FrameState=} opt_frameState Frame state.
|
|
||||||
*/
|
|
||||||
constructor(type, map, pointerEvent, opt_dragging, opt_frameState) {
|
|
||||||
super(type, map, pointerEvent, opt_dragging, opt_frameState);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @const
|
|
||||||
* @type {PointerEvent}
|
|
||||||
*/
|
|
||||||
this.pointerEvent = pointerEvent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default MapBrowserPointerEvent;
|
|
||||||
@@ -210,8 +210,8 @@ export const targetNotEditable = function (mapBrowserEvent) {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
export const mouseOnly = function (mapBrowserEvent) {
|
export const mouseOnly = function (mapBrowserEvent) {
|
||||||
const pointerEvent = /** @type {import("../MapBrowserPointerEvent").default} */ (mapBrowserEvent)
|
const pointerEvent = /** @type {import("../MapBrowserEvent").default} */ (mapBrowserEvent)
|
||||||
.pointerEvent;
|
.originalEvent;
|
||||||
assert(pointerEvent !== undefined, 56); // mapBrowserEvent must originate from a pointer event
|
assert(pointerEvent !== undefined, 56); // mapBrowserEvent must originate from a pointer event
|
||||||
// see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType
|
// see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType
|
||||||
return pointerEvent.pointerType == 'mouse';
|
return pointerEvent.pointerType == 'mouse';
|
||||||
@@ -225,8 +225,8 @@ export const mouseOnly = function (mapBrowserEvent) {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
export const touchOnly = function (mapBrowserEvent) {
|
export const touchOnly = function (mapBrowserEvent) {
|
||||||
const pointerEvt = /** @type {import("../MapBrowserPointerEvent").default} */ (mapBrowserEvent)
|
const pointerEvt = /** @type {import("../MapBrowserEvent").default} */ (mapBrowserEvent)
|
||||||
.pointerEvent;
|
.originalEvent;
|
||||||
assert(pointerEvt !== undefined, 56); // mapBrowserEvent must originate from a pointer event
|
assert(pointerEvt !== undefined, 56); // mapBrowserEvent must originate from a pointer event
|
||||||
// see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType
|
// see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType
|
||||||
return pointerEvt.pointerType === 'touch';
|
return pointerEvt.pointerType === 'touch';
|
||||||
@@ -240,8 +240,8 @@ export const touchOnly = function (mapBrowserEvent) {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
export const penOnly = function (mapBrowserEvent) {
|
export const penOnly = function (mapBrowserEvent) {
|
||||||
const pointerEvt = /** @type {import("../MapBrowserPointerEvent").default} */ (mapBrowserEvent)
|
const pointerEvt = /** @type {import("../MapBrowserEvent").default} */ (mapBrowserEvent)
|
||||||
.pointerEvent;
|
.originalEvent;
|
||||||
assert(pointerEvt !== undefined, 56); // mapBrowserEvent must originate from a pointer event
|
assert(pointerEvt !== undefined, 56); // mapBrowserEvent must originate from a pointer event
|
||||||
// see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType
|
// see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType
|
||||||
return pointerEvt.pointerType === 'pen';
|
return pointerEvt.pointerType === 'pen';
|
||||||
@@ -257,8 +257,8 @@ export const penOnly = function (mapBrowserEvent) {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
export const primaryAction = function (mapBrowserEvent) {
|
export const primaryAction = function (mapBrowserEvent) {
|
||||||
const pointerEvent = /** @type {import("../MapBrowserPointerEvent").default} */ (mapBrowserEvent)
|
const pointerEvent = /** @type {import("../MapBrowserEvent").default} */ (mapBrowserEvent)
|
||||||
.pointerEvent;
|
.originalEvent;
|
||||||
assert(pointerEvent !== undefined, 56); // mapBrowserEvent must originate from a pointer event
|
assert(pointerEvent !== undefined, 56); // mapBrowserEvent must originate from a pointer event
|
||||||
return pointerEvent.isPrimary && pointerEvent.button === 0;
|
return pointerEvent.isPrimary && pointerEvent.button === 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ export {default as Kinetic} from './Kinetic.js';
|
|||||||
export {default as Map} from './Map.js';
|
export {default as Map} from './Map.js';
|
||||||
export {default as MapBrowserEvent} from './MapBrowserEvent.js';
|
export {default as MapBrowserEvent} from './MapBrowserEvent.js';
|
||||||
export {default as MapBrowserEventHandler} from './MapBrowserEventHandler.js';
|
export {default as MapBrowserEventHandler} from './MapBrowserEventHandler.js';
|
||||||
export {default as MapBrowserPointerEvent} from './MapBrowserPointerEvent.js';
|
|
||||||
export {default as MapEvent} from './MapEvent.js';
|
export {default as MapEvent} from './MapEvent.js';
|
||||||
export {default as Object} from './Object.js';
|
export {default as Object} from './Object.js';
|
||||||
export {default as Observable} from './Observable.js';
|
export {default as Observable} from './Observable.js';
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ class DragBox extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer drag events.
|
* Handle pointer drag events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
*/
|
*/
|
||||||
handleDragEvent(mapBrowserEvent) {
|
handleDragEvent(mapBrowserEvent) {
|
||||||
this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel);
|
this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel);
|
||||||
@@ -186,7 +186,7 @@ class DragBox extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer up events.
|
* Handle pointer up events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
*/
|
*/
|
||||||
handleUpEvent(mapBrowserEvent) {
|
handleUpEvent(mapBrowserEvent) {
|
||||||
@@ -213,7 +213,7 @@ class DragBox extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer down events.
|
* Handle pointer down events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
*/
|
*/
|
||||||
handleDownEvent(mapBrowserEvent) {
|
handleDownEvent(mapBrowserEvent) {
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class DragPan extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer drag events.
|
* Handle pointer drag events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
*/
|
*/
|
||||||
handleDragEvent(mapBrowserEvent) {
|
handleDragEvent(mapBrowserEvent) {
|
||||||
if (!this.panning_) {
|
if (!this.panning_) {
|
||||||
@@ -123,7 +123,7 @@ class DragPan extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer up events.
|
* Handle pointer up events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
*/
|
*/
|
||||||
handleUpEvent(mapBrowserEvent) {
|
handleUpEvent(mapBrowserEvent) {
|
||||||
@@ -163,7 +163,7 @@ class DragPan extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer down events.
|
* Handle pointer down events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
*/
|
*/
|
||||||
handleDownEvent(mapBrowserEvent) {
|
handleDownEvent(mapBrowserEvent) {
|
||||||
@@ -192,7 +192,7 @@ class DragPan extends PointerInteraction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Browser event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Browser event.
|
||||||
* @return {boolean} Combined condition result.
|
* @return {boolean} Combined condition result.
|
||||||
*/
|
*/
|
||||||
function defaultCondition(mapBrowserEvent) {
|
function defaultCondition(mapBrowserEvent) {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class DragRotate extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer drag events.
|
* Handle pointer drag events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
*/
|
*/
|
||||||
handleDragEvent(mapBrowserEvent) {
|
handleDragEvent(mapBrowserEvent) {
|
||||||
if (!mouseOnly(mapBrowserEvent)) {
|
if (!mouseOnly(mapBrowserEvent)) {
|
||||||
@@ -84,7 +84,7 @@ class DragRotate extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer up events.
|
* Handle pointer up events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
*/
|
*/
|
||||||
handleUpEvent(mapBrowserEvent) {
|
handleUpEvent(mapBrowserEvent) {
|
||||||
@@ -100,7 +100,7 @@ class DragRotate extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer down events.
|
* Handle pointer down events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
*/
|
*/
|
||||||
handleDownEvent(mapBrowserEvent) {
|
handleDownEvent(mapBrowserEvent) {
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class DragRotateAndZoom extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer drag events.
|
* Handle pointer drag events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
*/
|
*/
|
||||||
handleDragEvent(mapBrowserEvent) {
|
handleDragEvent(mapBrowserEvent) {
|
||||||
if (!mouseOnly(mapBrowserEvent)) {
|
if (!mouseOnly(mapBrowserEvent)) {
|
||||||
@@ -97,7 +97,7 @@ class DragRotateAndZoom extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer up events.
|
* Handle pointer up events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
*/
|
*/
|
||||||
handleUpEvent(mapBrowserEvent) {
|
handleUpEvent(mapBrowserEvent) {
|
||||||
@@ -115,7 +115,7 @@ class DragRotateAndZoom extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer down events.
|
* Handle pointer down events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
*/
|
*/
|
||||||
handleDownEvent(mapBrowserEvent) {
|
handleDownEvent(mapBrowserEvent) {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import Feature from '../Feature.js';
|
|||||||
import GeometryType from '../geom/GeometryType.js';
|
import GeometryType from '../geom/GeometryType.js';
|
||||||
import InteractionProperty from './Property.js';
|
import InteractionProperty from './Property.js';
|
||||||
import LineString from '../geom/LineString.js';
|
import LineString from '../geom/LineString.js';
|
||||||
|
import MapBrowserEvent from '../MapBrowserEvent.js';
|
||||||
import MapBrowserEventType from '../MapBrowserEventType.js';
|
import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||||
import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js';
|
|
||||||
import MultiLineString from '../geom/MultiLineString.js';
|
import MultiLineString from '../geom/MultiLineString.js';
|
||||||
import MultiPoint from '../geom/MultiPoint.js';
|
import MultiPoint from '../geom/MultiPoint.js';
|
||||||
import MultiPolygon from '../geom/MultiPolygon.js';
|
import MultiPolygon from '../geom/MultiPolygon.js';
|
||||||
@@ -493,7 +493,7 @@ class Draw extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the {@link module:ol/MapBrowserEvent map browser event} and may actually draw or finish the drawing.
|
* Handles the {@link module:ol/MapBrowserEvent map browser event} and may actually draw or finish the drawing.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} event Map browser event.
|
* @param {import("../MapBrowserEvent.js").default} event Map browser event.
|
||||||
* @return {boolean} `false` to stop event propagation.
|
* @return {boolean} `false` to stop event propagation.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
@@ -545,7 +545,7 @@ class Draw extends PointerInteraction {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
event.pointerEvent.pointerType == 'mouse' ||
|
event.originalEvent.pointerType == 'mouse' ||
|
||||||
(event.type === MapBrowserEventType.POINTERDRAG &&
|
(event.type === MapBrowserEventType.POINTERDRAG &&
|
||||||
this.downTimeout_ === undefined)
|
this.downTimeout_ === undefined)
|
||||||
) {
|
) {
|
||||||
@@ -560,7 +560,7 @@ class Draw extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer down events.
|
* Handle pointer down events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} event Event.
|
* @param {import("../MapBrowserEvent.js").default} event Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
*/
|
*/
|
||||||
handleDownEvent(event) {
|
handleDownEvent(event) {
|
||||||
@@ -577,10 +577,10 @@ class Draw extends PointerInteraction {
|
|||||||
this.downTimeout_ = setTimeout(
|
this.downTimeout_ = setTimeout(
|
||||||
function () {
|
function () {
|
||||||
this.handlePointerMove_(
|
this.handlePointerMove_(
|
||||||
new MapBrowserPointerEvent(
|
new MapBrowserEvent(
|
||||||
MapBrowserEventType.POINTERMOVE,
|
MapBrowserEventType.POINTERMOVE,
|
||||||
event.map,
|
event.map,
|
||||||
event.pointerEvent,
|
event.originalEvent,
|
||||||
false,
|
false,
|
||||||
event.frameState
|
event.frameState
|
||||||
)
|
)
|
||||||
@@ -598,7 +598,7 @@ class Draw extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer up events.
|
* Handle pointer up events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} event Event.
|
* @param {import("../MapBrowserEvent.js").default} event Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
*/
|
*/
|
||||||
handleUpEvent(event) {
|
handleUpEvent(event) {
|
||||||
|
|||||||
@@ -276,11 +276,11 @@ class Extent extends PointerInteraction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Map browser event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||||
* @return {boolean} `false` to stop event propagation.
|
* @return {boolean} `false` to stop event propagation.
|
||||||
*/
|
*/
|
||||||
handleEvent(mapBrowserEvent) {
|
handleEvent(mapBrowserEvent) {
|
||||||
if (!mapBrowserEvent.pointerEvent) {
|
if (!mapBrowserEvent.originalEvent) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//display pointer (if not dragging)
|
//display pointer (if not dragging)
|
||||||
@@ -298,7 +298,7 @@ class Extent extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer down events.
|
* Handle pointer down events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
*/
|
*/
|
||||||
handleDownEvent(mapBrowserEvent) {
|
handleDownEvent(mapBrowserEvent) {
|
||||||
@@ -359,7 +359,7 @@ class Extent extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer drag events.
|
* Handle pointer drag events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
*/
|
*/
|
||||||
handleDragEvent(mapBrowserEvent) {
|
handleDragEvent(mapBrowserEvent) {
|
||||||
if (this.pointerHandler_) {
|
if (this.pointerHandler_) {
|
||||||
@@ -371,7 +371,7 @@ class Extent extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer up events.
|
* Handle pointer up events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
*/
|
*/
|
||||||
handleUpEvent(mapBrowserEvent) {
|
handleUpEvent(mapBrowserEvent) {
|
||||||
|
|||||||
@@ -130,10 +130,10 @@ export class ModifyEvent extends Event {
|
|||||||
* @param {ModifyEventType} type Type.
|
* @param {ModifyEventType} type Type.
|
||||||
* @param {Collection<Feature>} features
|
* @param {Collection<Feature>} features
|
||||||
* The features modified.
|
* The features modified.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserPointerEvent
|
* @param {import("../MapBrowserEvent.js").default} MapBrowserEvent
|
||||||
* Associated {@link module:ol/MapBrowserPointerEvent}.
|
* Associated {@link module:ol/MapBrowserEvent}.
|
||||||
*/
|
*/
|
||||||
constructor(type, features, mapBrowserPointerEvent) {
|
constructor(type, features, MapBrowserEvent) {
|
||||||
super(type);
|
super(type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -148,7 +148,7 @@ export class ModifyEvent extends Event {
|
|||||||
* @type {import("../MapBrowserEvent.js").default}
|
* @type {import("../MapBrowserEvent.js").default}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
this.mapBrowserEvent = mapBrowserPointerEvent;
|
this.mapBrowserEvent = MapBrowserEvent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,7 +350,7 @@ class Modify extends PointerInteraction {
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {import("../MapBrowserPointerEvent.js").default}
|
* @type {import("../MapBrowserEvent.js").default}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.lastPointerEvent_ = null;
|
this.lastPointerEvent_ = null;
|
||||||
@@ -376,7 +376,7 @@ class Modify extends PointerInteraction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} evt Map browser event
|
* @param {import("../MapBrowserEvent.js").default} evt Map browser event
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
willModifyFeatures_(evt) {
|
willModifyFeatures_(evt) {
|
||||||
@@ -743,11 +743,11 @@ class Modify extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the {@link module:ol/MapBrowserEvent map browser event} and may modify the geometry.
|
* Handles the {@link module:ol/MapBrowserEvent map browser event} and may modify the geometry.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Map browser event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||||
* @return {boolean} `false` to stop event propagation.
|
* @return {boolean} `false` to stop event propagation.
|
||||||
*/
|
*/
|
||||||
handleEvent(mapBrowserEvent) {
|
handleEvent(mapBrowserEvent) {
|
||||||
if (!mapBrowserEvent.pointerEvent) {
|
if (!mapBrowserEvent.originalEvent) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
this.lastPointerEvent_ = mapBrowserEvent;
|
this.lastPointerEvent_ = mapBrowserEvent;
|
||||||
@@ -780,7 +780,7 @@ class Modify extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer drag events.
|
* Handle pointer drag events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} evt Event.
|
* @param {import("../MapBrowserEvent.js").default} evt Event.
|
||||||
*/
|
*/
|
||||||
handleDragEvent(evt) {
|
handleDragEvent(evt) {
|
||||||
this.ignoreNextSingleClick_ = false;
|
this.ignoreNextSingleClick_ = false;
|
||||||
@@ -874,7 +874,7 @@ class Modify extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer down events.
|
* Handle pointer down events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} evt Event.
|
* @param {import("../MapBrowserEvent.js").default} evt Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
*/
|
*/
|
||||||
handleDownEvent(evt) {
|
handleDownEvent(evt) {
|
||||||
@@ -977,7 +977,7 @@ class Modify extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer up events.
|
* Handle pointer up events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} evt Event.
|
* @param {import("../MapBrowserEvent.js").default} evt Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
*/
|
*/
|
||||||
handleUpEvent(evt) {
|
handleUpEvent(evt) {
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class PinchRotate extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer drag events.
|
* Handle pointer drag events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
*/
|
*/
|
||||||
handleDragEvent(mapBrowserEvent) {
|
handleDragEvent(mapBrowserEvent) {
|
||||||
let rotationDelta = 0.0;
|
let rotationDelta = 0.0;
|
||||||
@@ -122,7 +122,7 @@ class PinchRotate extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer up events.
|
* Handle pointer up events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
*/
|
*/
|
||||||
handleUpEvent(mapBrowserEvent) {
|
handleUpEvent(mapBrowserEvent) {
|
||||||
@@ -138,7 +138,7 @@ class PinchRotate extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer down events.
|
* Handle pointer down events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
*/
|
*/
|
||||||
handleDownEvent(mapBrowserEvent) {
|
handleDownEvent(mapBrowserEvent) {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class PinchZoom extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer drag events.
|
* Handle pointer drag events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
*/
|
*/
|
||||||
handleDragEvent(mapBrowserEvent) {
|
handleDragEvent(mapBrowserEvent) {
|
||||||
let scaleDelta = 1.0;
|
let scaleDelta = 1.0;
|
||||||
@@ -98,7 +98,7 @@ class PinchZoom extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer up events.
|
* Handle pointer up events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
*/
|
*/
|
||||||
handleUpEvent(mapBrowserEvent) {
|
handleUpEvent(mapBrowserEvent) {
|
||||||
@@ -115,7 +115,7 @@ class PinchZoom extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer down events.
|
* Handle pointer down events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
*/
|
*/
|
||||||
handleDownEvent(mapBrowserEvent) {
|
handleDownEvent(mapBrowserEvent) {
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ import {getValues} from '../obj.js';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} Options
|
* @typedef {Object} Options
|
||||||
* @property {function(import("../MapBrowserPointerEvent.js").default):boolean} [handleDownEvent]
|
* @property {function(import("../MapBrowserEvent.js").default):boolean} [handleDownEvent]
|
||||||
* Function handling "down" events. If the function returns `true` then a drag
|
* Function handling "down" events. If the function returns `true` then a drag
|
||||||
* sequence is started.
|
* sequence is started.
|
||||||
* @property {function(import("../MapBrowserPointerEvent.js").default)} [handleDragEvent]
|
* @property {function(import("../MapBrowserEvent.js").default)} [handleDragEvent]
|
||||||
* Function handling "drag" events. This function is called on "move" events
|
* Function handling "drag" events. This function is called on "move" events
|
||||||
* during a drag sequence.
|
* during a drag sequence.
|
||||||
* @property {function(import("../MapBrowserEvent.js").default):boolean} [handleEvent]
|
* @property {function(import("../MapBrowserEvent.js").default):boolean} [handleEvent]
|
||||||
@@ -18,13 +18,13 @@ import {getValues} from '../obj.js';
|
|||||||
* dispatched to the map. The function may return `false` to prevent the
|
* dispatched to the map. The function may return `false` to prevent the
|
||||||
* propagation of the event to other interactions in the map's interactions
|
* propagation of the event to other interactions in the map's interactions
|
||||||
* chain.
|
* chain.
|
||||||
* @property {function(import("../MapBrowserPointerEvent.js").default)} [handleMoveEvent]
|
* @property {function(import("../MapBrowserEvent.js").default)} [handleMoveEvent]
|
||||||
* Function handling "move" events. This function is called on "move" events.
|
* Function handling "move" events. This function is called on "move" events.
|
||||||
* This functions is also called during a drag sequence, so during a drag
|
* This functions is also called during a drag sequence, so during a drag
|
||||||
* sequence both the `handleDragEvent` function and this function are called.
|
* sequence both the `handleDragEvent` function and this function are called.
|
||||||
* If `handleDownEvent` is defined and it returns true this function will not
|
* If `handleDownEvent` is defined and it returns true this function will not
|
||||||
* be called during a drag sequence.
|
* be called during a drag sequence.
|
||||||
* @property {function(import("../MapBrowserPointerEvent.js").default):boolean} [handleUpEvent]
|
* @property {function(import("../MapBrowserEvent.js").default):boolean} [handleUpEvent]
|
||||||
* Function handling "up" events. If the function returns `false` then the
|
* Function handling "up" events. If the function returns `false` then the
|
||||||
* current drag sequence is stopped.
|
* current drag sequence is stopped.
|
||||||
* @property {function(boolean):boolean} [stopDown]
|
* @property {function(boolean):boolean} [stopDown]
|
||||||
@@ -105,7 +105,7 @@ class PointerInteraction extends Interaction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer down events.
|
* Handle pointer down events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
@@ -115,7 +115,7 @@ class PointerInteraction extends Interaction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer drag events.
|
* Handle pointer drag events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
handleDragEvent(mapBrowserEvent) {}
|
handleDragEvent(mapBrowserEvent) {}
|
||||||
@@ -124,12 +124,12 @@ class PointerInteraction extends Interaction {
|
|||||||
* Handles the {@link module:ol/MapBrowserEvent map browser event} and may call into
|
* Handles the {@link module:ol/MapBrowserEvent map browser event} and may call into
|
||||||
* other functions, if event sequences like e.g. 'drag' or 'down-up' etc. are
|
* other functions, if event sequences like e.g. 'drag' or 'down-up' etc. are
|
||||||
* detected.
|
* detected.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Map browser event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||||
* @return {boolean} `false` to stop event propagation.
|
* @return {boolean} `false` to stop event propagation.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
handleEvent(mapBrowserEvent) {
|
handleEvent(mapBrowserEvent) {
|
||||||
if (!mapBrowserEvent.pointerEvent) {
|
if (!mapBrowserEvent.originalEvent) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,14 +159,14 @@ class PointerInteraction extends Interaction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer move events.
|
* Handle pointer move events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
handleMoveEvent(mapBrowserEvent) {}
|
handleMoveEvent(mapBrowserEvent) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer up events.
|
* Handle pointer up events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
@@ -185,12 +185,12 @@ class PointerInteraction extends Interaction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
updateTrackedPointers_(mapBrowserEvent) {
|
updateTrackedPointers_(mapBrowserEvent) {
|
||||||
if (isPointerDraggingEvent(mapBrowserEvent)) {
|
if (isPointerDraggingEvent(mapBrowserEvent)) {
|
||||||
const event = mapBrowserEvent.pointerEvent;
|
const event = mapBrowserEvent.originalEvent;
|
||||||
|
|
||||||
const id = event.pointerId.toString();
|
const id = event.pointerId.toString();
|
||||||
if (mapBrowserEvent.type == MapBrowserEventType.POINTERUP) {
|
if (mapBrowserEvent.type == MapBrowserEventType.POINTERUP) {
|
||||||
@@ -222,7 +222,7 @@ export function centroid(pointerEvents) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||||
* @return {boolean} Whether the event is a pointerdown, pointerdrag
|
* @return {boolean} Whether the event is a pointerdown, pointerdrag
|
||||||
* or pointerup event.
|
* or pointerup event.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ class Snap extends PointerInteraction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} evt Map browser event.
|
* @param {import("../MapBrowserEvent.js").default} evt Map browser event.
|
||||||
* @return {boolean} `false` to stop event propagation.
|
* @return {boolean} `false` to stop event propagation.
|
||||||
*/
|
*/
|
||||||
handleEvent(evt) {
|
handleEvent(evt) {
|
||||||
@@ -307,7 +307,7 @@ class Snap extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer up events.
|
* Handle pointer up events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} evt Event.
|
* @param {import("../MapBrowserEvent.js").default} evt Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
*/
|
*/
|
||||||
handleUpEvent(evt) {
|
handleUpEvent(evt) {
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ class Translate extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer down events.
|
* Handle pointer down events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} event Event.
|
* @param {import("../MapBrowserEvent.js").default} event Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
*/
|
*/
|
||||||
handleDownEvent(event) {
|
handleDownEvent(event) {
|
||||||
@@ -217,7 +217,7 @@ class Translate extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer up events.
|
* Handle pointer up events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} event Event.
|
* @param {import("../MapBrowserEvent.js").default} event Event.
|
||||||
* @return {boolean} If the event was consumed.
|
* @return {boolean} If the event was consumed.
|
||||||
*/
|
*/
|
||||||
handleUpEvent(event) {
|
handleUpEvent(event) {
|
||||||
@@ -245,7 +245,7 @@ class Translate extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer drag events.
|
* Handle pointer drag events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} event Event.
|
* @param {import("../MapBrowserEvent.js").default} event Event.
|
||||||
*/
|
*/
|
||||||
handleDragEvent(event) {
|
handleDragEvent(event) {
|
||||||
if (this.lastCoordinate_) {
|
if (this.lastCoordinate_) {
|
||||||
@@ -277,7 +277,7 @@ class Translate extends PointerInteraction {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle pointer move events.
|
* Handle pointer move events.
|
||||||
* @param {import("../MapBrowserPointerEvent.js").default} event Event.
|
* @param {import("../MapBrowserEvent.js").default} event Event.
|
||||||
*/
|
*/
|
||||||
handleMoveEvent(event) {
|
handleMoveEvent(event) {
|
||||||
const elem = event.map.getViewport();
|
const elem = event.map.getViewport();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import DragRotateAndZoom from '../../../../src/ol/interaction/DragRotateAndZoom.js';
|
import DragRotateAndZoom from '../../../../src/ol/interaction/DragRotateAndZoom.js';
|
||||||
import Event from '../../../../src/ol/events/Event.js';
|
import Event from '../../../../src/ol/events/Event.js';
|
||||||
import Map from '../../../../src/ol/Map.js';
|
import Map from '../../../../src/ol/Map.js';
|
||||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
import MapBrowserEvent from '../../../../src/ol/MapBrowserEvent.js';
|
||||||
import VectorLayer from '../../../../src/ol/layer/Vector.js';
|
import VectorLayer from '../../../../src/ol/layer/Vector.js';
|
||||||
import VectorSource from '../../../../src/ol/source/Vector.js';
|
import VectorSource from '../../../../src/ol/source/Vector.js';
|
||||||
import View from '../../../../src/ol/View.js';
|
import View from '../../../../src/ol/View.js';
|
||||||
@@ -58,12 +58,7 @@ describe('ol.interaction.DragRotateAndZoom', function () {
|
|||||||
pointerEvent.clientX = 20;
|
pointerEvent.clientX = 20;
|
||||||
pointerEvent.clientY = 10;
|
pointerEvent.clientY = 10;
|
||||||
pointerEvent.pointerType = 'mouse';
|
pointerEvent.pointerType = 'mouse';
|
||||||
let event = new MapBrowserPointerEvent(
|
let event = new MapBrowserEvent('pointermove', map, pointerEvent, true);
|
||||||
'pointermove',
|
|
||||||
map,
|
|
||||||
pointerEvent,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
interaction.lastAngle_ = Math.PI;
|
interaction.lastAngle_ = Math.PI;
|
||||||
|
|
||||||
let callCount = 0;
|
let callCount = 0;
|
||||||
@@ -93,12 +88,7 @@ describe('ol.interaction.DragRotateAndZoom', function () {
|
|||||||
pointerEvent.clientX = 24;
|
pointerEvent.clientX = 24;
|
||||||
pointerEvent.clientY = 16;
|
pointerEvent.clientY = 16;
|
||||||
pointerEvent.pointerType = 'mouse';
|
pointerEvent.pointerType = 'mouse';
|
||||||
event = new MapBrowserPointerEvent(
|
event = new MapBrowserEvent('pointermove', map, pointerEvent, true);
|
||||||
'pointermove',
|
|
||||||
map,
|
|
||||||
pointerEvent,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
interaction.handleDragEvent(event);
|
interaction.handleDragEvent(event);
|
||||||
expect(callCount).to.be(0);
|
expect(callCount).to.be(0);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import Feature from '../../../../src/ol/Feature.js';
|
|||||||
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
||||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||||
import Map from '../../../../src/ol/Map.js';
|
import Map from '../../../../src/ol/Map.js';
|
||||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
import MapBrowserEvent from '../../../../src/ol/MapBrowserEvent.js';
|
||||||
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
||||||
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
|
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
|
||||||
import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
|
import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
|
||||||
@@ -75,7 +75,7 @@ describe('ol.interaction.Draw', function () {
|
|||||||
* @param {number} x Horizontal offset from map center.
|
* @param {number} x Horizontal offset from map center.
|
||||||
* @param {number} y Vertical offset from map center.
|
* @param {number} y Vertical offset from map center.
|
||||||
* @param {boolean=} opt_shiftKey Shift key is pressed.
|
* @param {boolean=} opt_shiftKey Shift key is pressed.
|
||||||
* @return {module:ol/MapBrowserPointerEvent} The simulated event.
|
* @return {module:ol/MapBrowserEvent} The simulated event.
|
||||||
*/
|
*/
|
||||||
function simulateEvent(type, x, y, opt_shiftKey) {
|
function simulateEvent(type, x, y, opt_shiftKey) {
|
||||||
const viewport = map.getViewport();
|
const viewport = map.getViewport();
|
||||||
@@ -91,7 +91,7 @@ describe('ol.interaction.Draw', function () {
|
|||||||
event.preventDefault = function () {};
|
event.preventDefault = function () {};
|
||||||
event.pointerType = 'mouse';
|
event.pointerType = 'mouse';
|
||||||
event.pointerId = 0;
|
event.pointerId = 0;
|
||||||
const simulatedEvent = new MapBrowserPointerEvent(type, map, event);
|
const simulatedEvent = new MapBrowserEvent(type, map, event);
|
||||||
map.handleMapBrowserEvent(simulatedEvent);
|
map.handleMapBrowserEvent(simulatedEvent);
|
||||||
return simulatedEvent;
|
return simulatedEvent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import ExtentInteraction from '../../../../src/ol/interaction/Extent.js';
|
import ExtentInteraction from '../../../../src/ol/interaction/Extent.js';
|
||||||
import Map from '../../../../src/ol/Map.js';
|
import Map from '../../../../src/ol/Map.js';
|
||||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
import MapBrowserEvent from '../../../../src/ol/MapBrowserEvent.js';
|
||||||
import View from '../../../../src/ol/View.js';
|
import View from '../../../../src/ol/View.js';
|
||||||
|
|
||||||
describe('ol.interaction.Extent', function () {
|
describe('ol.interaction.Extent', function () {
|
||||||
@@ -58,8 +58,8 @@ describe('ol.interaction.Extent', function () {
|
|||||||
pointerEvent.shiftKey = shiftKey;
|
pointerEvent.shiftKey = shiftKey;
|
||||||
pointerEvent.pointerId = 0;
|
pointerEvent.pointerId = 0;
|
||||||
pointerEvent.preventDefault = function () {};
|
pointerEvent.preventDefault = function () {};
|
||||||
const event = new MapBrowserPointerEvent(type, map, pointerEvent);
|
const event = new MapBrowserEvent(type, map, pointerEvent);
|
||||||
event.pointerEvent.pointerId = 1;
|
event.originalEvent.pointerId = 1;
|
||||||
map.handleMapBrowserEvent(event);
|
map.handleMapBrowserEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import Event from '../../../../src/ol/events/Event.js';
|
|||||||
import Feature from '../../../../src/ol/Feature.js';
|
import Feature from '../../../../src/ol/Feature.js';
|
||||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||||
import Map from '../../../../src/ol/Map.js';
|
import Map from '../../../../src/ol/Map.js';
|
||||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
import MapBrowserEvent from '../../../../src/ol/MapBrowserEvent.js';
|
||||||
import Modify, {ModifyEvent} from '../../../../src/ol/interaction/Modify.js';
|
import Modify, {ModifyEvent} from '../../../../src/ol/interaction/Modify.js';
|
||||||
import Point from '../../../../src/ol/geom/Point.js';
|
import Point from '../../../../src/ol/geom/Point.js';
|
||||||
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
@@ -102,7 +102,7 @@ describe('ol.interaction.Modify', function () {
|
|||||||
pointerEvent.preventDefault = function () {};
|
pointerEvent.preventDefault = function () {};
|
||||||
pointerEvent.button = button;
|
pointerEvent.button = button;
|
||||||
pointerEvent.isPrimary = true;
|
pointerEvent.isPrimary = true;
|
||||||
const event = new MapBrowserPointerEvent(type, map, pointerEvent);
|
const event = new MapBrowserEvent(type, map, pointerEvent);
|
||||||
map.handleMapBrowserEvent(event);
|
map.handleMapBrowserEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Event from '../../../../src/ol/events/Event.js';
|
import Event from '../../../../src/ol/events/Event.js';
|
||||||
import Map from '../../../../src/ol/Map.js';
|
import Map from '../../../../src/ol/Map.js';
|
||||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
import MapBrowserEvent from '../../../../src/ol/MapBrowserEvent.js';
|
||||||
import PointerInteraction from '../../../../src/ol/interaction/Pointer.js';
|
import PointerInteraction from '../../../../src/ol/interaction/Pointer.js';
|
||||||
|
|
||||||
describe('ol.interaction.Pointer', function () {
|
describe('ol.interaction.Pointer', function () {
|
||||||
@@ -16,7 +16,7 @@ describe('ol.interaction.Pointer', function () {
|
|||||||
pointerEvent.preventDefault = function () {
|
pointerEvent.preventDefault = function () {
|
||||||
defaultPrevented = true;
|
defaultPrevented = true;
|
||||||
};
|
};
|
||||||
event = new MapBrowserPointerEvent(type, new Map(), pointerEvent);
|
event = new MapBrowserEvent(type, new Map(), pointerEvent);
|
||||||
defaultPrevented = false;
|
defaultPrevented = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import Collection from '../../../../src/ol/Collection.js';
|
|||||||
import Feature from '../../../../src/ol/Feature.js';
|
import Feature from '../../../../src/ol/Feature.js';
|
||||||
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
||||||
import Map from '../../../../src/ol/Map.js';
|
import Map from '../../../../src/ol/Map.js';
|
||||||
|
import MapBrowserEvent from '../../../../src/ol/MapBrowserEvent.js';
|
||||||
import MapBrowserEventType from '../../../../src/ol/MapBrowserEventType.js';
|
import MapBrowserEventType from '../../../../src/ol/MapBrowserEventType.js';
|
||||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
|
||||||
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import Select from '../../../../src/ol/interaction/Select.js';
|
import Select from '../../../../src/ol/interaction/Select.js';
|
||||||
import Style from '../../../../src/ol/style/Style.js';
|
import Style from '../../../../src/ol/style/Style.js';
|
||||||
@@ -106,7 +106,7 @@ describe('ol.interaction.Select', function () {
|
|||||||
clientY: position.top + y + height / 2,
|
clientY: position.top + y + height / 2,
|
||||||
shiftKey: shiftKey,
|
shiftKey: shiftKey,
|
||||||
};
|
};
|
||||||
map.handleMapBrowserEvent(new MapBrowserPointerEvent(type, map, event));
|
map.handleMapBrowserEvent(new MapBrowserEvent(type, map, event));
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('constructor', function () {
|
describe('constructor', function () {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import Collection from '../../../../src/ol/Collection.js';
|
|||||||
import Feature from '../../../../src/ol/Feature.js';
|
import Feature from '../../../../src/ol/Feature.js';
|
||||||
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
||||||
import Map from '../../../../src/ol/Map.js';
|
import Map from '../../../../src/ol/Map.js';
|
||||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
import MapBrowserEvent from '../../../../src/ol/MapBrowserEvent.js';
|
||||||
import Point from '../../../../src/ol/geom/Point.js';
|
import Point from '../../../../src/ol/geom/Point.js';
|
||||||
import Translate, {
|
import Translate, {
|
||||||
TranslateEvent,
|
TranslateEvent,
|
||||||
@@ -69,7 +69,7 @@ describe('ol.interaction.Translate', function () {
|
|||||||
// calculated in case body has top < 0 (test runner with small window)
|
// calculated in case body has top < 0 (test runner with small window)
|
||||||
const position = viewport.getBoundingClientRect();
|
const position = viewport.getBoundingClientRect();
|
||||||
const shiftKey = opt_shiftKey !== undefined ? opt_shiftKey : false;
|
const shiftKey = opt_shiftKey !== undefined ? opt_shiftKey : false;
|
||||||
const event = new MapBrowserPointerEvent(type, map, {
|
const event = new MapBrowserEvent(type, map, {
|
||||||
type: type,
|
type: type,
|
||||||
target: viewport.firstChild,
|
target: viewport.firstChild,
|
||||||
pointerId: 0,
|
pointerId: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user