Rename _ol_interaction_Interaction_ to Interaction
This commit is contained in:
@@ -2,7 +2,7 @@ import _ol_Map_ from '../../../../src/ol/Map.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';
|
||||
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
||||
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
|
||||
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
|
||||
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
|
||||
@@ -62,7 +62,7 @@ describe('ol.interaction.DragRotateAndZoom', function() {
|
||||
new _ol_pointer_PointerEvent_('pointermove', {clientX: 20, clientY: 10}, {pointerType: 'mouse'}),
|
||||
true);
|
||||
interaction.lastAngle_ = Math.PI;
|
||||
var spy = sinon.spy(_ol_interaction_Interaction_, 'rotateWithoutConstraints');
|
||||
var spy = sinon.spy(Interaction, 'rotateWithoutConstraints');
|
||||
interaction.handleDragEvent_(event);
|
||||
expect(spy.callCount).to.be(1);
|
||||
expect(interaction.lastAngle_).to.be(-0.8308214428190254);
|
||||
@@ -77,7 +77,7 @@ describe('ol.interaction.DragRotateAndZoom', function() {
|
||||
true);
|
||||
interaction.handleDragEvent_(event);
|
||||
expect(spy.callCount).to.be(1);
|
||||
_ol_interaction_Interaction_.rotateWithoutConstraints.restore();
|
||||
Interaction.rotateWithoutConstraints.restore();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
|
||||
import Point from '../../../../src/ol/geom/Point.js';
|
||||
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||
import _ol_interaction_Draw_ from '../../../../src/ol/interaction/Draw.js';
|
||||
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js';
|
||||
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
||||
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
|
||||
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
|
||||
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
|
||||
@@ -84,7 +84,7 @@ describe('ol.interaction.Draw', function() {
|
||||
type: 'Point'
|
||||
});
|
||||
expect(draw).to.be.a(_ol_interaction_Draw_);
|
||||
expect(draw).to.be.a(_ol_interaction_Interaction_);
|
||||
expect(draw).to.be.a(Interaction);
|
||||
});
|
||||
|
||||
it('accepts a freehand option', function() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import _ol_Map_ from '../../../../src/ol/Map.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
import EventTarget from '../../../../src/ol/events/EventTarget.js';
|
||||
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js';
|
||||
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
||||
|
||||
describe('ol.interaction.Interaction', function() {
|
||||
|
||||
@@ -9,11 +9,11 @@ describe('ol.interaction.Interaction', function() {
|
||||
var interaction;
|
||||
|
||||
beforeEach(function() {
|
||||
interaction = new _ol_interaction_Interaction_({});
|
||||
interaction = new Interaction({});
|
||||
});
|
||||
|
||||
it('creates a new interaction', function() {
|
||||
expect(interaction).to.be.a(_ol_interaction_Interaction_);
|
||||
expect(interaction).to.be.a(Interaction);
|
||||
expect(interaction).to.be.a(EventTarget);
|
||||
});
|
||||
|
||||
@@ -27,13 +27,13 @@ describe('ol.interaction.Interaction', function() {
|
||||
|
||||
it('retrieves the associated map', function() {
|
||||
var map = new _ol_Map_({});
|
||||
var interaction = new _ol_interaction_Interaction_({});
|
||||
var interaction = new Interaction({});
|
||||
interaction.setMap(map);
|
||||
expect(interaction.getMap()).to.be(map);
|
||||
});
|
||||
|
||||
it('returns null if no map', function() {
|
||||
var interaction = new _ol_interaction_Interaction_({});
|
||||
var interaction = new Interaction({});
|
||||
expect(interaction.getMap()).to.be(null);
|
||||
});
|
||||
|
||||
@@ -43,13 +43,13 @@ describe('ol.interaction.Interaction', function() {
|
||||
|
||||
it('allows a map to be set', function() {
|
||||
var map = new _ol_Map_({});
|
||||
var interaction = new _ol_interaction_Interaction_({});
|
||||
var interaction = new Interaction({});
|
||||
interaction.setMap(map);
|
||||
expect(interaction.getMap()).to.be(map);
|
||||
});
|
||||
|
||||
it('accepts null', function() {
|
||||
var interaction = new _ol_interaction_Interaction_({});
|
||||
var interaction = new Interaction({});
|
||||
interaction.setMap(null);
|
||||
expect(interaction.getMap()).to.be(null);
|
||||
});
|
||||
@@ -64,16 +64,16 @@ describe('ol.interaction.Interaction', function() {
|
||||
resolutions: [4, 2, 1, 0.5, 0.25]
|
||||
});
|
||||
|
||||
_ol_interaction_Interaction_.zoomByDelta(view, 1);
|
||||
Interaction.zoomByDelta(view, 1);
|
||||
expect(view.getResolution()).to.be(0.5);
|
||||
|
||||
_ol_interaction_Interaction_.zoomByDelta(view, -1);
|
||||
Interaction.zoomByDelta(view, -1);
|
||||
expect(view.getResolution()).to.be(1);
|
||||
|
||||
_ol_interaction_Interaction_.zoomByDelta(view, 2);
|
||||
Interaction.zoomByDelta(view, 2);
|
||||
expect(view.getResolution()).to.be(0.25);
|
||||
|
||||
_ol_interaction_Interaction_.zoomByDelta(view, -2);
|
||||
Interaction.zoomByDelta(view, -2);
|
||||
expect(view.getResolution()).to.be(1);
|
||||
});
|
||||
|
||||
@@ -84,16 +84,16 @@ describe('ol.interaction.Interaction', function() {
|
||||
resolutions: [4, 2, 1, 0.5, 0.25]
|
||||
});
|
||||
|
||||
_ol_interaction_Interaction_.zoomByDelta(view, 1, [10, 10]);
|
||||
Interaction.zoomByDelta(view, 1, [10, 10]);
|
||||
expect(view.getCenter()).to.eql([5, 5]);
|
||||
|
||||
_ol_interaction_Interaction_.zoomByDelta(view, -1, [0, 0]);
|
||||
Interaction.zoomByDelta(view, -1, [0, 0]);
|
||||
expect(view.getCenter()).to.eql([10, 10]);
|
||||
|
||||
_ol_interaction_Interaction_.zoomByDelta(view, 2, [0, 0]);
|
||||
Interaction.zoomByDelta(view, 2, [0, 0]);
|
||||
expect(view.getCenter()).to.eql([2.5, 2.5]);
|
||||
|
||||
_ol_interaction_Interaction_.zoomByDelta(view, -2, [0, 0]);
|
||||
Interaction.zoomByDelta(view, -2, [0, 0]);
|
||||
expect(view.getCenter()).to.eql([10, 10]);
|
||||
});
|
||||
|
||||
@@ -105,16 +105,16 @@ describe('ol.interaction.Interaction', function() {
|
||||
resolutions: [4, 2, 1, 0.5, 0.25]
|
||||
});
|
||||
|
||||
_ol_interaction_Interaction_.zoomByDelta(view, 1, [10, 10]);
|
||||
Interaction.zoomByDelta(view, 1, [10, 10]);
|
||||
expect(view.getCenter()).to.eql([2.5, 2.5]);
|
||||
|
||||
_ol_interaction_Interaction_.zoomByDelta(view, -1, [0, 0]);
|
||||
Interaction.zoomByDelta(view, -1, [0, 0]);
|
||||
expect(view.getCenter()).to.eql([2.5, 2.5]);
|
||||
|
||||
_ol_interaction_Interaction_.zoomByDelta(view, 2, [10, 10]);
|
||||
Interaction.zoomByDelta(view, 2, [10, 10]);
|
||||
expect(view.getCenter()).to.eql([2.5, 2.5]);
|
||||
|
||||
_ol_interaction_Interaction_.zoomByDelta(view, -2, [0, 0]);
|
||||
Interaction.zoomByDelta(view, -2, [0, 0]);
|
||||
expect(view.getCenter()).to.eql([2.5, 2.5]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,7 +2,8 @@ import _ol_Map_ from '../../../../src/ol/Map.js';
|
||||
import MapBrowserEvent from '../../../../src/ol/MapBrowserEvent.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
import Event from '../../../../src/ol/events/Event.js';
|
||||
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js';
|
||||
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
||||
|
||||
describe('ol.interaction.KeyboardPan', function() {
|
||||
var map;
|
||||
|
||||
@@ -23,7 +24,7 @@ describe('ol.interaction.KeyboardPan', function() {
|
||||
|
||||
describe('handleEvent()', function() {
|
||||
it('pans on arrow keys', function() {
|
||||
var spy = sinon.spy(_ol_interaction_Interaction_, 'pan');
|
||||
var spy = sinon.spy(Interaction, 'pan');
|
||||
var event = new MapBrowserEvent('keydown', map, {
|
||||
type: 'keydown',
|
||||
target: map.getTargetElement(),
|
||||
@@ -41,7 +42,7 @@ describe('ol.interaction.KeyboardPan', function() {
|
||||
expect(spy.getCall(1).args[1]).to.eql([0, 128]);
|
||||
expect(spy.getCall(2).args[1]).to.eql([-128, 0]);
|
||||
expect(spy.getCall(3).args[1]).to.eql([128, 0]);
|
||||
_ol_interaction_Interaction_.pan.restore();
|
||||
Interaction.pan.restore();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@ import _ol_Map_ from '../../../../src/ol/Map.js';
|
||||
import MapBrowserEvent from '../../../../src/ol/MapBrowserEvent.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
import Event from '../../../../src/ol/events/Event.js';
|
||||
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js';
|
||||
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
||||
|
||||
describe('ol.interaction.KeyboardZoom', function() {
|
||||
var map;
|
||||
|
||||
@@ -23,7 +24,7 @@ describe('ol.interaction.KeyboardZoom', function() {
|
||||
|
||||
describe('handleEvent()', function() {
|
||||
it('zooms on + and - keys', function() {
|
||||
var spy = sinon.spy(_ol_interaction_Interaction_, 'zoomByDelta');
|
||||
var spy = sinon.spy(Interaction, 'zoomByDelta');
|
||||
var event = new MapBrowserEvent('keydown', map, {
|
||||
type: 'keydown',
|
||||
target: map.getTargetElement(),
|
||||
@@ -35,7 +36,7 @@ describe('ol.interaction.KeyboardZoom', function() {
|
||||
map.handleMapBrowserEvent(event);
|
||||
expect(spy.getCall(0).args[1]).to.eql(1);
|
||||
expect(spy.getCall(1).args[1]).to.eql(-1);
|
||||
_ol_interaction_Interaction_.zoomByDelta.restore();
|
||||
Interaction.zoomByDelta.restore();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import MapBrowserEvent from '../../../../src/ol/MapBrowserEvent.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
import Event from '../../../../src/ol/events/Event.js';
|
||||
import _ol_has_ from '../../../../src/ol/has.js';
|
||||
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js';
|
||||
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
||||
import _ol_interaction_MouseWheelZoom_ from '../../../../src/ol/interaction/MouseWheelZoom.js';
|
||||
|
||||
|
||||
@@ -33,13 +33,13 @@ describe('ol.interaction.MouseWheelZoom', function() {
|
||||
describe('timeout duration', function() {
|
||||
var clock;
|
||||
beforeEach(function() {
|
||||
sinon.spy(_ol_interaction_Interaction_, 'zoomByDelta');
|
||||
sinon.spy(Interaction, 'zoomByDelta');
|
||||
clock = sinon.useFakeTimers();
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
clock.restore();
|
||||
_ol_interaction_Interaction_.zoomByDelta.restore();
|
||||
Interaction.zoomByDelta.restore();
|
||||
});
|
||||
|
||||
it('works with the defaut value', function(done) {
|
||||
@@ -51,9 +51,9 @@ describe('ol.interaction.MouseWheelZoom', function() {
|
||||
map.handleMapBrowserEvent(event);
|
||||
clock.tick(50);
|
||||
// default timeout is 80 ms, not called yet
|
||||
expect(_ol_interaction_Interaction_.zoomByDelta.called).to.be(false);
|
||||
expect(Interaction.zoomByDelta.called).to.be(false);
|
||||
clock.tick(30);
|
||||
expect(_ol_interaction_Interaction_.zoomByDelta.called).to.be(true);
|
||||
expect(Interaction.zoomByDelta.called).to.be(true);
|
||||
|
||||
done();
|
||||
});
|
||||
@@ -102,15 +102,15 @@ describe('ol.interaction.MouseWheelZoom', function() {
|
||||
|
||||
describe('spying on ol.interaction.Interaction.zoomByDelta', function() {
|
||||
beforeEach(function() {
|
||||
sinon.spy(_ol_interaction_Interaction_, 'zoomByDelta');
|
||||
sinon.spy(Interaction, 'zoomByDelta');
|
||||
});
|
||||
afterEach(function() {
|
||||
_ol_interaction_Interaction_.zoomByDelta.restore();
|
||||
Interaction.zoomByDelta.restore();
|
||||
});
|
||||
|
||||
it('works in DOM_DELTA_LINE mode (wheel)', function(done) {
|
||||
map.once('postrender', function() {
|
||||
var call = _ol_interaction_Interaction_.zoomByDelta.getCall(0);
|
||||
var call = Interaction.zoomByDelta.getCall(0);
|
||||
expect(call.args[1]).to.be(-1);
|
||||
expect(call.args[2]).to.eql([0, 0]);
|
||||
done();
|
||||
@@ -130,7 +130,7 @@ describe('ol.interaction.MouseWheelZoom', function() {
|
||||
var origHasSafari = _ol_has_.SAFARI;
|
||||
_ol_has_.SAFARI = true;
|
||||
map.once('postrender', function() {
|
||||
var call = _ol_interaction_Interaction_.zoomByDelta.getCall(0);
|
||||
var call = Interaction.zoomByDelta.getCall(0);
|
||||
expect(call.args[1]).to.be(-1);
|
||||
expect(call.args[2]).to.eql([0, 0]);
|
||||
_ol_has_.SAFARI = origHasSafari;
|
||||
@@ -150,7 +150,7 @@ describe('ol.interaction.MouseWheelZoom', function() {
|
||||
var origHasSafari = _ol_has_.SAFARI;
|
||||
_ol_has_.SAFARI = false;
|
||||
map.once('postrender', function() {
|
||||
var call = _ol_interaction_Interaction_.zoomByDelta.getCall(0);
|
||||
var call = Interaction.zoomByDelta.getCall(0);
|
||||
expect(call.args[1]).to.be(-1);
|
||||
expect(call.args[2]).to.eql([0, 0]);
|
||||
_ol_has_.SAFARI = origHasSafari;
|
||||
|
||||
@@ -5,7 +5,7 @@ import MapBrowserEventType from '../../../../src/ol/MapBrowserEventType.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';
|
||||
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
||||
import _ol_interaction_Select_ from '../../../../src/ol/interaction/Select.js';
|
||||
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
|
||||
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
|
||||
@@ -105,7 +105,7 @@ describe('ol.interaction.Select', function() {
|
||||
it('creates a new interaction', function() {
|
||||
var select = new _ol_interaction_Select_();
|
||||
expect(select).to.be.a(_ol_interaction_Select_);
|
||||
expect(select).to.be.a(_ol_interaction_Interaction_);
|
||||
expect(select).to.be.a(Interaction);
|
||||
});
|
||||
|
||||
describe('user-provided collection', function() {
|
||||
|
||||
@@ -5,7 +5,7 @@ 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';
|
||||
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js';
|
||||
import Interaction from '../../../../src/ol/interaction/Interaction.js';
|
||||
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
|
||||
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
|
||||
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
|
||||
@@ -136,7 +136,7 @@ describe('ol.interaction.Translate', function() {
|
||||
features: features
|
||||
});
|
||||
expect(translate).to.be.a(_ol_interaction_Translate_);
|
||||
expect(translate).to.be.a(_ol_interaction_Interaction_);
|
||||
expect(translate).to.be.a(Interaction);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@ import Point from '../../../src/ol/geom/Point.js';
|
||||
import _ol_has_ from '../../../src/ol/has.js';
|
||||
import _ol_interaction_ from '../../../src/ol/interaction.js';
|
||||
import _ol_interaction_DoubleClickZoom_ from '../../../src/ol/interaction/DoubleClickZoom.js';
|
||||
import _ol_interaction_Interaction_ from '../../../src/ol/interaction/Interaction.js';
|
||||
import Interaction from '../../../src/ol/interaction/Interaction.js';
|
||||
import _ol_interaction_MouseWheelZoom_ from '../../../src/ol/interaction/MouseWheelZoom.js';
|
||||
import _ol_interaction_PinchZoom_ from '../../../src/ol/interaction/PinchZoom.js';
|
||||
import _ol_layer_Tile_ from '../../../src/ol/layer/Tile.js';
|
||||
@@ -77,7 +77,7 @@ describe('ol.Map', function() {
|
||||
describe('#addInteraction()', function() {
|
||||
it('adds an interaction to the map', function() {
|
||||
var map = new _ol_Map_({});
|
||||
var interaction = new _ol_interaction_Interaction_({});
|
||||
var interaction = new Interaction({});
|
||||
|
||||
var before = map.getInteractions().getLength();
|
||||
map.addInteraction(interaction);
|
||||
@@ -90,7 +90,7 @@ describe('ol.Map', function() {
|
||||
describe('#removeInteraction()', function() {
|
||||
it('removes an interaction from the map', function() {
|
||||
var map = new _ol_Map_({});
|
||||
var interaction = new _ol_interaction_Interaction_({});
|
||||
var interaction = new Interaction({});
|
||||
|
||||
var before = map.getInteractions().getLength();
|
||||
map.addInteraction(interaction);
|
||||
|
||||
Reference in New Issue
Block a user