Transformed
This commit is contained in:
@@ -1,21 +1,19 @@
|
||||
|
||||
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.MapBrowserPointerEvent');
|
||||
goog.require('ol.View');
|
||||
goog.require('ol.interaction.DragRotateAndZoom');
|
||||
goog.require('ol.interaction.Interaction');
|
||||
goog.require('ol.layer.Vector');
|
||||
goog.require('ol.pointer.PointerEvent');
|
||||
goog.require('ol.source.Vector');
|
||||
import _ol_Map_ from '../../../../src/ol/Map.js';
|
||||
import _ol_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 _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';
|
||||
|
||||
describe('ol.interaction.DragRotateAndZoom', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed without arguments', function() {
|
||||
var instance = new ol.interaction.DragRotateAndZoom();
|
||||
expect(instance).to.be.an(ol.interaction.DragRotateAndZoom);
|
||||
var instance = new _ol_interaction_DragRotateAndZoom_();
|
||||
expect(instance).to.be.an(_ol_interaction_DragRotateAndZoom_);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -36,14 +34,14 @@ describe('ol.interaction.DragRotateAndZoom', function() {
|
||||
style.width = width + 'px';
|
||||
style.height = height + 'px';
|
||||
document.body.appendChild(target);
|
||||
var source = new ol.source.Vector();
|
||||
var layer = new ol.layer.Vector({source: source});
|
||||
interaction = new ol.interaction.DragRotateAndZoom();
|
||||
map = new ol.Map({
|
||||
var source = new _ol_source_Vector_();
|
||||
var layer = new _ol_layer_Vector_({source: source});
|
||||
interaction = new _ol_interaction_DragRotateAndZoom_();
|
||||
map = new _ol_Map_({
|
||||
target: target,
|
||||
layers: [layer],
|
||||
interactions: [interaction],
|
||||
view: new ol.View({
|
||||
view: new _ol_View_({
|
||||
projection: 'EPSG:4326',
|
||||
center: [0, 0],
|
||||
resolution: 1
|
||||
@@ -60,26 +58,26 @@ describe('ol.interaction.DragRotateAndZoom', function() {
|
||||
});
|
||||
|
||||
it('does not rotate when rotation is disabled on the view', function() {
|
||||
var event = new ol.MapBrowserPointerEvent('pointermove', map,
|
||||
new ol.pointer.PointerEvent('pointermove', {clientX: 20, clientY: 10}, {pointerType: 'mouse'}),
|
||||
var event = new _ol_MapBrowserPointerEvent_('pointermove', map,
|
||||
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(_ol_interaction_Interaction_, 'rotateWithoutConstraints');
|
||||
interaction.handleDragEvent_(event);
|
||||
expect(spy.callCount).to.be(1);
|
||||
expect(interaction.lastAngle_).to.be(-0.8308214428190254);
|
||||
map.setView(new ol.View({
|
||||
map.setView(new _ol_View_({
|
||||
projection: 'EPSG:4326',
|
||||
center: [0, 0],
|
||||
resolution: 1,
|
||||
enableRotation: false
|
||||
}));
|
||||
event = new ol.MapBrowserPointerEvent('pointermove', map,
|
||||
new ol.pointer.PointerEvent('pointermove', {clientX: 24, clientY: 16}, {pointerType: 'mouse'}),
|
||||
event = new _ol_MapBrowserPointerEvent_('pointermove', map,
|
||||
new _ol_pointer_PointerEvent_('pointermove', {clientX: 24, clientY: 16}, {pointerType: 'mouse'}),
|
||||
true);
|
||||
interaction.handleDragEvent_(event);
|
||||
expect(spy.callCount).to.be(1);
|
||||
ol.interaction.Interaction.rotateWithoutConstraints.restore();
|
||||
_ol_interaction_Interaction_.rotateWithoutConstraints.restore();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user