Use pepjs instead of our own pointerevent polyfill

This commit is contained in:
ahocevar
2019-08-28 21:48:06 +02:00
parent aca4a39863
commit 74e8e013cf
27 changed files with 197 additions and 2430 deletions

View File

@@ -15,7 +15,7 @@ import Polygon from '../../../../src/ol/geom/Polygon.js';
import Draw, {createRegularPolygon, createBox} from '../../../../src/ol/interaction/Draw.js';
import Interaction from '../../../../src/ol/interaction/Interaction.js';
import VectorLayer from '../../../../src/ol/layer/Vector.js';
import PointerEvent from '../../../../src/ol/pointer/PointerEvent.js';
import Event from '../../../../src/ol/events/Event.js';
import VectorSource from '../../../../src/ol/source/Vector.js';
@@ -69,14 +69,14 @@ describe('ol.interaction.Draw', function() {
// calculated in case body has top < 0 (test runner with small window)
const position = viewport.getBoundingClientRect();
const shiftKey = opt_shiftKey !== undefined ? opt_shiftKey : false;
const event = new PointerEvent(type, {
clientX: position.left + x + width / 2,
clientY: position.top + y + height / 2,
shiftKey: shiftKey,
preventDefault: function() {}
}, {
pointerType: 'mouse'
});
const event = new Event();
event.type = type;
event.clientX = position.left + x + width / 2;
event.clientY = position.top + y + height / 2;
event.shiftKey = shiftKey;
event.preventDefault = function() {};
event.pointerType = 'mouse';
event.pointerId = 0;
const simulatedEvent = new MapBrowserPointerEvent(type, map, event);
map.handleMapBrowserEvent(simulatedEvent);
return simulatedEvent;