Rename _ol_pointer_PointerEvent_ to PointerEvent
This commit is contained in:
@@ -47,7 +47,7 @@ import Event from '../events/Event.js';
|
|||||||
* @param {Object.<string, ?>=} opt_eventDict An optional dictionary of
|
* @param {Object.<string, ?>=} opt_eventDict An optional dictionary of
|
||||||
* initial event properties.
|
* initial event properties.
|
||||||
*/
|
*/
|
||||||
var _ol_pointer_PointerEvent_ = function(type, originalEvent, opt_eventDict) {
|
var PointerEvent = function(type, originalEvent, opt_eventDict) {
|
||||||
Event.call(this, type);
|
Event.call(this, type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -192,7 +192,7 @@ var _ol_pointer_PointerEvent_ = function(type, originalEvent, opt_eventDict) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inherits(_ol_pointer_PointerEvent_, Event);
|
inherits(PointerEvent, Event);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -200,7 +200,7 @@ inherits(_ol_pointer_PointerEvent_, Event);
|
|||||||
* @param {Object.<string, ?>} eventDict The event dictionary.
|
* @param {Object.<string, ?>} eventDict The event dictionary.
|
||||||
* @return {number} Button indicator.
|
* @return {number} Button indicator.
|
||||||
*/
|
*/
|
||||||
_ol_pointer_PointerEvent_.prototype.getButtons_ = function(eventDict) {
|
PointerEvent.prototype.getButtons_ = function(eventDict) {
|
||||||
// According to the w3c spec,
|
// According to the w3c spec,
|
||||||
// http://www.w3.org/TR/DOM-Level-3-Events/#events-MouseEvent-button
|
// http://www.w3.org/TR/DOM-Level-3-Events/#events-MouseEvent-button
|
||||||
// MouseEvent.button == 0 can mean either no mouse button depressed, or the
|
// MouseEvent.button == 0 can mean either no mouse button depressed, or the
|
||||||
@@ -223,7 +223,7 @@ _ol_pointer_PointerEvent_.prototype.getButtons_ = function(eventDict) {
|
|||||||
//
|
//
|
||||||
// This is fixed with DOM Level 4's use of buttons
|
// This is fixed with DOM Level 4's use of buttons
|
||||||
var buttons;
|
var buttons;
|
||||||
if (eventDict.buttons || _ol_pointer_PointerEvent_.HAS_BUTTONS) {
|
if (eventDict.buttons || PointerEvent.HAS_BUTTONS) {
|
||||||
buttons = eventDict.buttons;
|
buttons = eventDict.buttons;
|
||||||
} else {
|
} else {
|
||||||
switch (eventDict.which) {
|
switch (eventDict.which) {
|
||||||
@@ -243,7 +243,7 @@ _ol_pointer_PointerEvent_.prototype.getButtons_ = function(eventDict) {
|
|||||||
* @param {number} buttons Button indicator.
|
* @param {number} buttons Button indicator.
|
||||||
* @return {number} The pressure.
|
* @return {number} The pressure.
|
||||||
*/
|
*/
|
||||||
_ol_pointer_PointerEvent_.prototype.getPressure_ = function(eventDict, buttons) {
|
PointerEvent.prototype.getPressure_ = function(eventDict, buttons) {
|
||||||
// Spec requires that pointers without pressure specified use 0.5 for down
|
// Spec requires that pointers without pressure specified use 0.5 for down
|
||||||
// state and 0 for up state.
|
// state and 0 for up state.
|
||||||
var pressure = 0;
|
var pressure = 0;
|
||||||
@@ -260,7 +260,7 @@ _ol_pointer_PointerEvent_.prototype.getPressure_ = function(eventDict, buttons)
|
|||||||
* Is the `buttons` property supported?
|
* Is the `buttons` property supported?
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
_ol_pointer_PointerEvent_.HAS_BUTTONS = false;
|
PointerEvent.HAS_BUTTONS = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -269,9 +269,9 @@ _ol_pointer_PointerEvent_.HAS_BUTTONS = false;
|
|||||||
(function() {
|
(function() {
|
||||||
try {
|
try {
|
||||||
var ev = new MouseEvent('click', {buttons: 1});
|
var ev = new MouseEvent('click', {buttons: 1});
|
||||||
_ol_pointer_PointerEvent_.HAS_BUTTONS = ev.buttons === 1;
|
PointerEvent.HAS_BUTTONS = ev.buttons === 1;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// pass
|
// pass
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
export default _ol_pointer_PointerEvent_;
|
export default PointerEvent;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import PointerEventType from '../pointer/EventType.js';
|
|||||||
import _ol_pointer_MouseSource_ from '../pointer/MouseSource.js';
|
import _ol_pointer_MouseSource_ from '../pointer/MouseSource.js';
|
||||||
import _ol_pointer_MsSource_ from '../pointer/MsSource.js';
|
import _ol_pointer_MsSource_ from '../pointer/MsSource.js';
|
||||||
import _ol_pointer_NativeSource_ from '../pointer/NativeSource.js';
|
import _ol_pointer_NativeSource_ from '../pointer/NativeSource.js';
|
||||||
import _ol_pointer_PointerEvent_ from '../pointer/PointerEvent.js';
|
import PointerEvent from '../pointer/PointerEvent.js';
|
||||||
import _ol_pointer_TouchSource_ from '../pointer/TouchSource.js';
|
import _ol_pointer_TouchSource_ from '../pointer/TouchSource.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -353,7 +353,7 @@ PointerEventHandler.prototype.contains_ = function(container, contained) {
|
|||||||
* @return {ol.pointer.PointerEvent} A PointerEvent of type `inType`.
|
* @return {ol.pointer.PointerEvent} A PointerEvent of type `inType`.
|
||||||
*/
|
*/
|
||||||
PointerEventHandler.prototype.makeEvent = function(inType, data, event) {
|
PointerEventHandler.prototype.makeEvent = function(inType, data, event) {
|
||||||
return new _ol_pointer_PointerEvent_(inType, event, data);
|
return new PointerEvent(inType, event, data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import Map from '../../../../src/ol/Map.js';
|
import Map from '../../../../src/ol/Map.js';
|
||||||
import View from '../../../../src/ol/View.js';
|
import View from '../../../../src/ol/View.js';
|
||||||
import ZoomSlider from '../../../../src/ol/control/ZoomSlider.js';
|
import ZoomSlider from '../../../../src/ol/control/ZoomSlider.js';
|
||||||
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
|
import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js';
|
||||||
|
|
||||||
describe('ol.control.ZoomSlider', function() {
|
describe('ol.control.ZoomSlider', function() {
|
||||||
var map, target, zoomslider;
|
var map, target, zoomslider;
|
||||||
@@ -111,7 +111,7 @@ describe('ol.control.ZoomSlider', function() {
|
|||||||
control.element.firstChild.style.height = '10px';
|
control.element.firstChild.style.height = '10px';
|
||||||
map.renderSync();
|
map.renderSync();
|
||||||
var dragger = control.dragger_;
|
var dragger = control.dragger_;
|
||||||
var event = new _ol_pointer_PointerEvent_('pointerdown', {
|
var event = new PointerEvent('pointerdown', {
|
||||||
target: control.element.firstElementChild
|
target: control.element.firstElementChild
|
||||||
});
|
});
|
||||||
event.clientX = control.widthLimit_;
|
event.clientX = control.widthLimit_;
|
||||||
@@ -143,7 +143,7 @@ describe('ol.control.ZoomSlider', function() {
|
|||||||
map.getView().setZoom(8);
|
map.getView().setZoom(8);
|
||||||
map.renderSync();
|
map.renderSync();
|
||||||
var dragger = control.dragger_;
|
var dragger = control.dragger_;
|
||||||
var event = new _ol_pointer_PointerEvent_('pointerdown', {
|
var event = new PointerEvent('pointerdown', {
|
||||||
target: control.element.firstElementChild
|
target: control.element.firstElementChild
|
||||||
});
|
});
|
||||||
event.clientX = 0;
|
event.clientX = 0;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import View from '../../../../src/ol/View.js';
|
|||||||
import DragRotateAndZoom from '../../../../src/ol/interaction/DragRotateAndZoom.js';
|
import DragRotateAndZoom from '../../../../src/ol/interaction/DragRotateAndZoom.js';
|
||||||
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
||||||
import VectorLayer from '../../../../src/ol/layer/Vector.js';
|
import VectorLayer from '../../../../src/ol/layer/Vector.js';
|
||||||
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
|
import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js';
|
||||||
import VectorSource from '../../../../src/ol/source/Vector.js';
|
import VectorSource from '../../../../src/ol/source/Vector.js';
|
||||||
|
|
||||||
describe('ol.interaction.DragRotateAndZoom', function() {
|
describe('ol.interaction.DragRotateAndZoom', function() {
|
||||||
@@ -59,7 +59,7 @@ describe('ol.interaction.DragRotateAndZoom', function() {
|
|||||||
|
|
||||||
it('does not rotate when rotation is disabled on the view', function() {
|
it('does not rotate when rotation is disabled on the view', function() {
|
||||||
var event = new MapBrowserPointerEvent('pointermove', map,
|
var event = new MapBrowserPointerEvent('pointermove', map,
|
||||||
new _ol_pointer_PointerEvent_('pointermove', {clientX: 20, clientY: 10}, {pointerType: 'mouse'}),
|
new PointerEvent('pointermove', {clientX: 20, clientY: 10}, {pointerType: 'mouse'}),
|
||||||
true);
|
true);
|
||||||
interaction.lastAngle_ = Math.PI;
|
interaction.lastAngle_ = Math.PI;
|
||||||
var spy = sinon.spy(Interaction, 'rotateWithoutConstraints');
|
var spy = sinon.spy(Interaction, 'rotateWithoutConstraints');
|
||||||
@@ -73,7 +73,7 @@ describe('ol.interaction.DragRotateAndZoom', function() {
|
|||||||
enableRotation: false
|
enableRotation: false
|
||||||
}));
|
}));
|
||||||
event = new MapBrowserPointerEvent('pointermove', map,
|
event = new MapBrowserPointerEvent('pointermove', map,
|
||||||
new _ol_pointer_PointerEvent_('pointermove', {clientX: 24, clientY: 16}, {pointerType: 'mouse'}),
|
new PointerEvent('pointermove', {clientX: 24, clientY: 16}, {pointerType: 'mouse'}),
|
||||||
true);
|
true);
|
||||||
interaction.handleDragEvent_(event);
|
interaction.handleDragEvent_(event);
|
||||||
expect(spy.callCount).to.be(1);
|
expect(spy.callCount).to.be(1);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import Polygon from '../../../../src/ol/geom/Polygon.js';
|
|||||||
import Draw from '../../../../src/ol/interaction/Draw.js';
|
import Draw from '../../../../src/ol/interaction/Draw.js';
|
||||||
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
||||||
import VectorLayer from '../../../../src/ol/layer/Vector.js';
|
import VectorLayer from '../../../../src/ol/layer/Vector.js';
|
||||||
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
|
import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js';
|
||||||
import VectorSource from '../../../../src/ol/source/Vector.js';
|
import VectorSource from '../../../../src/ol/source/Vector.js';
|
||||||
|
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ describe('ol.interaction.Draw', 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)
|
||||||
var position = viewport.getBoundingClientRect();
|
var position = viewport.getBoundingClientRect();
|
||||||
var shiftKey = opt_shiftKey !== undefined ? opt_shiftKey : false;
|
var shiftKey = opt_shiftKey !== undefined ? opt_shiftKey : false;
|
||||||
var event = new _ol_pointer_PointerEvent_(type, {
|
var event = new PointerEvent(type, {
|
||||||
clientX: position.left + x + width / 2,
|
clientX: position.left + x + width / 2,
|
||||||
clientY: position.top + y + height / 2,
|
clientY: position.top + y + height / 2,
|
||||||
shiftKey: shiftKey
|
shiftKey: shiftKey
|
||||||
@@ -94,7 +94,7 @@ describe('ol.interaction.Draw', function() {
|
|||||||
freehand: true
|
freehand: true
|
||||||
});
|
});
|
||||||
|
|
||||||
var event = new _ol_pointer_PointerEvent_('pointerdown', {
|
var event = new PointerEvent('pointerdown', {
|
||||||
clientX: 0,
|
clientX: 0,
|
||||||
clientY: 0,
|
clientY: 0,
|
||||||
shiftKey: false
|
shiftKey: false
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import Map from '../../../../src/ol/Map.js';
|
|||||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||||
import View from '../../../../src/ol/View.js';
|
import View from '../../../../src/ol/View.js';
|
||||||
import ExtentInteraction from '../../../../src/ol/interaction/Extent.js';
|
import ExtentInteraction from '../../../../src/ol/interaction/Extent.js';
|
||||||
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
|
import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js';
|
||||||
|
|
||||||
describe('ol.interaction.Extent', function() {
|
describe('ol.interaction.Extent', function() {
|
||||||
var map, interaction;
|
var map, interaction;
|
||||||
@@ -50,7 +50,7 @@ describe('ol.interaction.Extent', 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)
|
||||||
var position = viewport.getBoundingClientRect();
|
var position = viewport.getBoundingClientRect();
|
||||||
var shiftKey = opt_shiftKey !== undefined ? opt_shiftKey : false;
|
var shiftKey = opt_shiftKey !== undefined ? opt_shiftKey : false;
|
||||||
var pointerEvent = new _ol_pointer_PointerEvent_(type, {
|
var pointerEvent = new PointerEvent(type, {
|
||||||
type: type,
|
type: type,
|
||||||
button: button,
|
button: button,
|
||||||
clientX: position.left + x + width / 2,
|
clientX: position.left + x + width / 2,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import Point from '../../../../src/ol/geom/Point.js';
|
|||||||
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import Modify from '../../../../src/ol/interaction/Modify.js';
|
import Modify from '../../../../src/ol/interaction/Modify.js';
|
||||||
import VectorLayer from '../../../../src/ol/layer/Vector.js';
|
import VectorLayer from '../../../../src/ol/layer/Vector.js';
|
||||||
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
|
import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js';
|
||||||
import VectorSource from '../../../../src/ol/source/Vector.js';
|
import VectorSource from '../../../../src/ol/source/Vector.js';
|
||||||
|
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
var viewport = map.getViewport();
|
var viewport = map.getViewport();
|
||||||
// calculated in case body has top < 0 (test runner with small window)
|
// calculated in case body has top < 0 (test runner with small window)
|
||||||
var position = viewport.getBoundingClientRect();
|
var position = viewport.getBoundingClientRect();
|
||||||
var pointerEvent = new _ol_pointer_PointerEvent_(type, {
|
var pointerEvent = new PointerEvent(type, {
|
||||||
type: type,
|
type: type,
|
||||||
clientX: position.left + x + width / 2,
|
clientX: position.left + x + width / 2,
|
||||||
clientY: position.top + y + height / 2,
|
clientY: position.top + y + height / 2,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import Polygon from '../../../../src/ol/geom/Polygon.js';
|
|||||||
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
||||||
import Select from '../../../../src/ol/interaction/Select.js';
|
import Select from '../../../../src/ol/interaction/Select.js';
|
||||||
import VectorLayer from '../../../../src/ol/layer/Vector.js';
|
import VectorLayer from '../../../../src/ol/layer/Vector.js';
|
||||||
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
|
import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js';
|
||||||
import VectorSource from '../../../../src/ol/source/Vector.js';
|
import VectorSource from '../../../../src/ol/source/Vector.js';
|
||||||
|
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ describe('ol.interaction.Select', 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)
|
||||||
var position = viewport.getBoundingClientRect();
|
var position = viewport.getBoundingClientRect();
|
||||||
var shiftKey = opt_shiftKey !== undefined ? opt_shiftKey : false;
|
var shiftKey = opt_shiftKey !== undefined ? opt_shiftKey : false;
|
||||||
var event = new _ol_pointer_PointerEvent_(type, {
|
var event = new PointerEvent(type, {
|
||||||
clientX: position.left + x + width / 2,
|
clientX: position.left + x + width / 2,
|
||||||
clientY: position.top + y + height / 2,
|
clientY: position.top + y + height / 2,
|
||||||
shiftKey: shiftKey
|
shiftKey: shiftKey
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import Point from '../../../../src/ol/geom/Point.js';
|
|||||||
import _ol_interaction_Translate_ from '../../../../src/ol/interaction/Translate.js';
|
import _ol_interaction_Translate_ from '../../../../src/ol/interaction/Translate.js';
|
||||||
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
||||||
import VectorLayer from '../../../../src/ol/layer/Vector.js';
|
import VectorLayer from '../../../../src/ol/layer/Vector.js';
|
||||||
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
|
import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js';
|
||||||
import VectorSource from '../../../../src/ol/source/Vector.js';
|
import VectorSource from '../../../../src/ol/source/Vector.js';
|
||||||
|
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ describe('ol.interaction.Translate', function() {
|
|||||||
var position = viewport.getBoundingClientRect();
|
var position = viewport.getBoundingClientRect();
|
||||||
var shiftKey = opt_shiftKey !== undefined ? opt_shiftKey : false;
|
var shiftKey = opt_shiftKey !== undefined ? opt_shiftKey : false;
|
||||||
var event = new MapBrowserPointerEvent(type, map,
|
var event = new MapBrowserPointerEvent(type, map,
|
||||||
new _ol_pointer_PointerEvent_(type, {
|
new PointerEvent(type, {
|
||||||
clientX: position.left + x + width / 2,
|
clientX: position.left + x + width / 2,
|
||||||
clientY: position.top + y + height / 2,
|
clientY: position.top + y + height / 2,
|
||||||
shiftKey: shiftKey
|
shiftKey: shiftKey
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import Map from '../../../src/ol/Map.js';
|
|||||||
import MapBrowserEventHandler from '../../../src/ol/MapBrowserEventHandler.js';
|
import MapBrowserEventHandler from '../../../src/ol/MapBrowserEventHandler.js';
|
||||||
import _ol_events_ from '../../../src/ol/events.js';
|
import _ol_events_ from '../../../src/ol/events.js';
|
||||||
import _ol_has_ from '../../../src/ol/has.js';
|
import _ol_has_ from '../../../src/ol/has.js';
|
||||||
import _ol_pointer_PointerEvent_ from '../../../src/ol/pointer/PointerEvent.js';
|
import PointerEvent from '../../../src/ol/pointer/PointerEvent.js';
|
||||||
|
|
||||||
describe('ol.MapBrowserEventHandler', function() {
|
describe('ol.MapBrowserEventHandler', function() {
|
||||||
describe('#emulateClick_', function() {
|
describe('#emulateClick_', function() {
|
||||||
@@ -36,7 +36,7 @@ describe('ol.MapBrowserEventHandler', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('emulates click', function() {
|
it('emulates click', function() {
|
||||||
handler.emulateClick_(new _ol_pointer_PointerEvent_('pointerdown', {
|
handler.emulateClick_(new PointerEvent('pointerdown', {
|
||||||
type: 'mousedown',
|
type: 'mousedown',
|
||||||
target: target,
|
target: target,
|
||||||
clientX: 0,
|
clientX: 0,
|
||||||
@@ -46,7 +46,7 @@ describe('ol.MapBrowserEventHandler', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('emulates singleclick', function() {
|
it('emulates singleclick', function() {
|
||||||
handler.emulateClick_(new _ol_pointer_PointerEvent_('pointerdown', {
|
handler.emulateClick_(new PointerEvent('pointerdown', {
|
||||||
type: 'mousedown',
|
type: 'mousedown',
|
||||||
target: target,
|
target: target,
|
||||||
clientX: 0,
|
clientX: 0,
|
||||||
@@ -59,7 +59,7 @@ describe('ol.MapBrowserEventHandler', function() {
|
|||||||
expect(singleclickSpy.calledOnce).to.be.ok();
|
expect(singleclickSpy.calledOnce).to.be.ok();
|
||||||
expect(dblclickSpy.called).to.not.be.ok();
|
expect(dblclickSpy.called).to.not.be.ok();
|
||||||
|
|
||||||
handler.emulateClick_(new _ol_pointer_PointerEvent_('pointerdown', {
|
handler.emulateClick_(new PointerEvent('pointerdown', {
|
||||||
type: 'mousedown',
|
type: 'mousedown',
|
||||||
target: target,
|
target: target,
|
||||||
clientX: 0,
|
clientX: 0,
|
||||||
@@ -70,7 +70,7 @@ describe('ol.MapBrowserEventHandler', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('emulates dblclick', function() {
|
it('emulates dblclick', function() {
|
||||||
handler.emulateClick_(new _ol_pointer_PointerEvent_('pointerdown', {
|
handler.emulateClick_(new PointerEvent('pointerdown', {
|
||||||
type: 'mousedown',
|
type: 'mousedown',
|
||||||
target: target,
|
target: target,
|
||||||
clientX: 0,
|
clientX: 0,
|
||||||
@@ -79,7 +79,7 @@ describe('ol.MapBrowserEventHandler', function() {
|
|||||||
expect(singleclickSpy.called).to.not.be.ok();
|
expect(singleclickSpy.called).to.not.be.ok();
|
||||||
expect(dblclickSpy.called).to.not.be.ok();
|
expect(dblclickSpy.called).to.not.be.ok();
|
||||||
|
|
||||||
handler.emulateClick_(new _ol_pointer_PointerEvent_('pointerdown', {
|
handler.emulateClick_(new PointerEvent('pointerdown', {
|
||||||
type: 'mousedown',
|
type: 'mousedown',
|
||||||
target: target,
|
target: target,
|
||||||
clientX: 0,
|
clientX: 0,
|
||||||
@@ -107,7 +107,7 @@ describe('ol.MapBrowserEventHandler', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('is an event after handlePointerDown_ has been called', function() {
|
it('is an event after handlePointerDown_ has been called', function() {
|
||||||
var event = new _ol_pointer_PointerEvent_('pointerdown', {});
|
var event = new PointerEvent('pointerdown', {});
|
||||||
handler.handlePointerDown_(event);
|
handler.handlePointerDown_(event);
|
||||||
expect(handler.down_).to.be(event);
|
expect(handler.down_).to.be(event);
|
||||||
});
|
});
|
||||||
@@ -121,7 +121,7 @@ describe('ol.MapBrowserEventHandler', function() {
|
|||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
defaultHandler = new MapBrowserEventHandler(new Map({}));
|
defaultHandler = new MapBrowserEventHandler(new Map({}));
|
||||||
moveToleranceHandler = new MapBrowserEventHandler(new Map({}), 8);
|
moveToleranceHandler = new MapBrowserEventHandler(new Map({}), 8);
|
||||||
pointerdownAt0 = new _ol_pointer_PointerEvent_('pointerdown', {}, {
|
pointerdownAt0 = new PointerEvent('pointerdown', {}, {
|
||||||
clientX: 0,
|
clientX: 0,
|
||||||
clientY: 0
|
clientY: 0
|
||||||
});
|
});
|
||||||
@@ -130,7 +130,7 @@ describe('ol.MapBrowserEventHandler', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('is not moving if distance is 0', function() {
|
it('is not moving if distance is 0', function() {
|
||||||
var pointerdownAt0 = new _ol_pointer_PointerEvent_('pointerdown', {}, {
|
var pointerdownAt0 = new PointerEvent('pointerdown', {}, {
|
||||||
clientX: 0,
|
clientX: 0,
|
||||||
clientY: 0
|
clientY: 0
|
||||||
});
|
});
|
||||||
@@ -138,7 +138,7 @@ describe('ol.MapBrowserEventHandler', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('is moving if distance is 2', function() {
|
it('is moving if distance is 2', function() {
|
||||||
var pointerdownAt2 = new _ol_pointer_PointerEvent_('pointerdown', {}, {
|
var pointerdownAt2 = new PointerEvent('pointerdown', {}, {
|
||||||
clientX: _ol_has_.DEVICE_PIXEL_RATIO + 1,
|
clientX: _ol_has_.DEVICE_PIXEL_RATIO + 1,
|
||||||
clientY: _ol_has_.DEVICE_PIXEL_RATIO + 1
|
clientY: _ol_has_.DEVICE_PIXEL_RATIO + 1
|
||||||
});
|
});
|
||||||
@@ -146,7 +146,7 @@ describe('ol.MapBrowserEventHandler', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('is moving with negative distance', function() {
|
it('is moving with negative distance', function() {
|
||||||
var pointerdownAt2 = new _ol_pointer_PointerEvent_('pointerdown', {}, {
|
var pointerdownAt2 = new PointerEvent('pointerdown', {}, {
|
||||||
clientX: -(_ol_has_.DEVICE_PIXEL_RATIO + 1),
|
clientX: -(_ol_has_.DEVICE_PIXEL_RATIO + 1),
|
||||||
clientY: -(_ol_has_.DEVICE_PIXEL_RATIO + 1)
|
clientY: -(_ol_has_.DEVICE_PIXEL_RATIO + 1)
|
||||||
});
|
});
|
||||||
@@ -154,7 +154,7 @@ describe('ol.MapBrowserEventHandler', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('is not moving if distance is less than move tolerance', function() {
|
it('is not moving if distance is less than move tolerance', function() {
|
||||||
var pointerdownAt2 = new _ol_pointer_PointerEvent_('pointerdown', {}, {
|
var pointerdownAt2 = new PointerEvent('pointerdown', {}, {
|
||||||
clientX: _ol_has_.DEVICE_PIXEL_RATIO + 1,
|
clientX: _ol_has_.DEVICE_PIXEL_RATIO + 1,
|
||||||
clientY: _ol_has_.DEVICE_PIXEL_RATIO + 1
|
clientY: _ol_has_.DEVICE_PIXEL_RATIO + 1
|
||||||
});
|
});
|
||||||
@@ -162,7 +162,7 @@ describe('ol.MapBrowserEventHandler', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('is moving if distance is greater than move tolerance', function() {
|
it('is moving if distance is greater than move tolerance', function() {
|
||||||
var pointerdownAt9 = new _ol_pointer_PointerEvent_('pointerdown', {}, {
|
var pointerdownAt9 = new PointerEvent('pointerdown', {}, {
|
||||||
clientX: (_ol_has_.DEVICE_PIXEL_RATIO * 8) + 1,
|
clientX: (_ol_has_.DEVICE_PIXEL_RATIO * 8) + 1,
|
||||||
clientY: (_ol_has_.DEVICE_PIXEL_RATIO * 8) + 1
|
clientY: (_ol_has_.DEVICE_PIXEL_RATIO * 8) + 1
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import _ol_events_ from '../../../../src/ol/events.js';
|
|||||||
import EventTarget from '../../../../src/ol/events/EventTarget.js';
|
import EventTarget from '../../../../src/ol/events/EventTarget.js';
|
||||||
import _ol_has_ from '../../../../src/ol/has.js';
|
import _ol_has_ from '../../../../src/ol/has.js';
|
||||||
import _ol_pointer_MouseSource_ from '../../../../src/ol/pointer/MouseSource.js';
|
import _ol_pointer_MouseSource_ from '../../../../src/ol/pointer/MouseSource.js';
|
||||||
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
|
import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js';
|
||||||
import PointerEventHandler from '../../../../src/ol/pointer/PointerEventHandler.js';
|
import PointerEventHandler from '../../../../src/ol/pointer/PointerEventHandler.js';
|
||||||
|
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ describe('ol.pointer.PointerEventHandler', function() {
|
|||||||
expect(eventSpy.calledOnce).to.be.ok();
|
expect(eventSpy.calledOnce).to.be.ok();
|
||||||
|
|
||||||
var pointerEvent = eventSpy.firstCall.args[0];
|
var pointerEvent = eventSpy.firstCall.args[0];
|
||||||
expect(pointerEvent).to.be.a(_ol_pointer_PointerEvent_);
|
expect(pointerEvent).to.be.a(PointerEvent);
|
||||||
expect(pointerEvent.type).to.be('pointerdown');
|
expect(pointerEvent.type).to.be('pointerdown');
|
||||||
expect(pointerEvent.pointerId).to.be(1);
|
expect(pointerEvent.pointerId).to.be(1);
|
||||||
expect(pointerEvent.pointerType).to.be('mouse');
|
expect(pointerEvent.pointerType).to.be('mouse');
|
||||||
@@ -160,7 +160,7 @@ describe('ol.pointer.PointerEventHandler', function() {
|
|||||||
|
|
||||||
expect(pointerEvent.preventDefault).to.be.ok();
|
expect(pointerEvent.preventDefault).to.be.ok();
|
||||||
|
|
||||||
expect(pointerEvent).to.be.a(_ol_pointer_PointerEvent_);
|
expect(pointerEvent).to.be.a(PointerEvent);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user