Transformed
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
|
||||
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.View');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.interaction.DragZoom');
|
||||
goog.require('ol.layer.Vector');
|
||||
goog.require('ol.render.Box');
|
||||
goog.require('ol.source.Vector');
|
||||
import _ol_Map_ from '../../../../src/ol/Map.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
import _ol_extent_ from '../../../../src/ol/extent.js';
|
||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
||||
import _ol_interaction_DragZoom_ from '../../../../src/ol/interaction/DragZoom.js';
|
||||
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
|
||||
import _ol_render_Box_ from '../../../../src/ol/render/Box.js';
|
||||
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
|
||||
|
||||
|
||||
describe('ol.interaction.DragZoom', function() {
|
||||
@@ -26,12 +24,12 @@ describe('ol.interaction.DragZoom', function() {
|
||||
style.width = width + 'px';
|
||||
style.height = height + 'px';
|
||||
document.body.appendChild(target);
|
||||
source = new ol.source.Vector();
|
||||
var layer = new ol.layer.Vector({source: source});
|
||||
map = new ol.Map({
|
||||
source = new _ol_source_Vector_();
|
||||
var layer = new _ol_layer_Vector_({source: source});
|
||||
map = new _ol_Map_({
|
||||
target: target,
|
||||
layers: [layer],
|
||||
view: new ol.View({
|
||||
view: new _ol_View_({
|
||||
projection: 'EPSG:4326',
|
||||
center: [0, 0],
|
||||
resolution: 1
|
||||
@@ -50,15 +48,15 @@ describe('ol.interaction.DragZoom', function() {
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed without arguments', function() {
|
||||
var instance = new ol.interaction.DragZoom();
|
||||
expect(instance).to.be.an(ol.interaction.DragZoom);
|
||||
var instance = new _ol_interaction_DragZoom_();
|
||||
expect(instance).to.be.an(_ol_interaction_DragZoom_);
|
||||
});
|
||||
it('sets "ol-dragzoom" as box className', function() {
|
||||
var instance = new ol.interaction.DragZoom();
|
||||
var instance = new _ol_interaction_DragZoom_();
|
||||
expect(instance.box_.element_.className).to.be('ol-box ol-dragzoom');
|
||||
});
|
||||
it('sets a custom box className', function() {
|
||||
var instance = new ol.interaction.DragZoom({className: 'test-dragzoom'});
|
||||
var instance = new _ol_interaction_DragZoom_({className: 'test-dragzoom'});
|
||||
expect(instance.box_.element_.className).to.be('ol-box test-dragzoom');
|
||||
});
|
||||
|
||||
@@ -67,36 +65,36 @@ describe('ol.interaction.DragZoom', function() {
|
||||
describe('#onBoxEnd()', function() {
|
||||
|
||||
it('centers the view on the box geometry', function(done) {
|
||||
var interaction = new ol.interaction.DragZoom({
|
||||
var interaction = new _ol_interaction_DragZoom_({
|
||||
duration: 10
|
||||
});
|
||||
map.addInteraction(interaction);
|
||||
|
||||
var box = new ol.render.Box();
|
||||
var box = new _ol_render_Box_();
|
||||
var extent = [-110, 40, -90, 60];
|
||||
box.geometry_ = ol.geom.Polygon.fromExtent(extent);
|
||||
box.geometry_ = _ol_geom_Polygon_.fromExtent(extent);
|
||||
interaction.box_ = box;
|
||||
|
||||
interaction.onBoxEnd();
|
||||
setTimeout(function() {
|
||||
var view = map.getView();
|
||||
var center = view.getCenter();
|
||||
expect(center).to.eql(ol.extent.getCenter(extent));
|
||||
expect(center).to.eql(_ol_extent_.getCenter(extent));
|
||||
done();
|
||||
}, 50);
|
||||
|
||||
});
|
||||
|
||||
it('sets new resolution while zooming out', function(done) {
|
||||
var interaction = new ol.interaction.DragZoom({
|
||||
var interaction = new _ol_interaction_DragZoom_({
|
||||
duration: 10,
|
||||
out: true
|
||||
});
|
||||
map.addInteraction(interaction);
|
||||
|
||||
var box = new ol.render.Box();
|
||||
var box = new _ol_render_Box_();
|
||||
var extent = [-11.25, -11.25, 11.25, 11.25];
|
||||
box.geometry_ = ol.geom.Polygon.fromExtent(extent);
|
||||
box.geometry_ = _ol_geom_Polygon_.fromExtent(extent);
|
||||
interaction.box_ = box;
|
||||
|
||||
map.getView().setResolution(0.25);
|
||||
|
||||
Reference in New Issue
Block a user