diff --git a/src/ol/interaction/doubleclickzoom.js b/src/ol/interaction/doubleclickzoom.js index de4f6d95b4..056393781e 100644 --- a/src/ol/interaction/doubleclickzoom.js +++ b/src/ol/interaction/doubleclickzoom.js @@ -55,7 +55,7 @@ ol.interaction.DoubleClickZoom.handleEvent = function(mapBrowserEvent) { var delta = browserEvent.shiftKey ? -this.delta_ : this.delta_; var view = map.getView(); ol.interaction.Interaction.zoomByDelta( - map, view, delta, anchor, this.duration_); + view, delta, anchor, this.duration_); mapBrowserEvent.preventDefault(); stopEvent = true; } diff --git a/src/ol/interaction/dragrotate.js b/src/ol/interaction/dragrotate.js index aa85d786aa..3954ac7a0c 100644 --- a/src/ol/interaction/dragrotate.js +++ b/src/ol/interaction/dragrotate.js @@ -73,7 +73,7 @@ ol.interaction.DragRotate.handleDragEvent_ = function(mapBrowserEvent) { var view = map.getView(); var rotation = view.getRotation(); ol.interaction.Interaction.rotateWithoutConstraints( - map, view, rotation - delta); + view, rotation - delta); } this.lastAngle_ = theta; }; @@ -94,7 +94,7 @@ ol.interaction.DragRotate.handleUpEvent_ = function(mapBrowserEvent) { var view = map.getView(); view.setHint(ol.ViewHint.INTERACTING, -1); var rotation = view.getRotation(); - ol.interaction.Interaction.rotate(map, view, rotation, + ol.interaction.Interaction.rotate(view, rotation, undefined, this.duration_); return false; }; diff --git a/src/ol/interaction/dragrotateandzoom.js b/src/ol/interaction/dragrotateandzoom.js index 1364449759..d033ff8a53 100644 --- a/src/ol/interaction/dragrotateandzoom.js +++ b/src/ol/interaction/dragrotateandzoom.js @@ -88,12 +88,12 @@ ol.interaction.DragRotateAndZoom.handleDragEvent_ = function(mapBrowserEvent) { if (this.lastAngle_ !== undefined) { var angleDelta = theta - this.lastAngle_; ol.interaction.Interaction.rotateWithoutConstraints( - map, view, view.getRotation() - angleDelta); + view, view.getRotation() - angleDelta); } this.lastAngle_ = theta; if (this.lastMagnitude_ !== undefined) { var resolution = this.lastMagnitude_ * (view.getResolution() / magnitude); - ol.interaction.Interaction.zoomWithoutConstraints(map, view, resolution); + ol.interaction.Interaction.zoomWithoutConstraints(view, resolution); } if (this.lastMagnitude_ !== undefined) { this.lastScaleDelta_ = this.lastMagnitude_ / magnitude; @@ -117,8 +117,8 @@ ol.interaction.DragRotateAndZoom.handleUpEvent_ = function(mapBrowserEvent) { var view = map.getView(); view.setHint(ol.ViewHint.INTERACTING, -1); var direction = this.lastScaleDelta_ - 1; - ol.interaction.Interaction.rotate(map, view, view.getRotation()); - ol.interaction.Interaction.zoom(map, view, view.getResolution(), + ol.interaction.Interaction.rotate(view, view.getRotation()); + ol.interaction.Interaction.zoom(view, view.getResolution(), undefined, this.duration_, direction); this.lastScaleDelta_ = 0; return false; diff --git a/src/ol/interaction/interaction.js b/src/ol/interaction/interaction.js index f9dcc33e28..6ce00e740e 100644 --- a/src/ol/interaction/interaction.js +++ b/src/ol/interaction/interaction.js @@ -91,12 +91,11 @@ ol.interaction.Interaction.prototype.setMap = function(map) { /** - * @param {ol.Map} map Map. * @param {ol.View} view View. * @param {ol.Coordinate} delta Delta. * @param {number=} opt_duration Duration. */ -ol.interaction.Interaction.pan = function(map, view, delta, opt_duration) { +ol.interaction.Interaction.pan = function(view, delta, opt_duration) { var currentCenter = view.getCenter(); if (currentCenter) { var center = view.constrainCenter( @@ -115,27 +114,25 @@ ol.interaction.Interaction.pan = function(map, view, delta, opt_duration) { /** - * @param {ol.Map} map Map. * @param {ol.View} view View. * @param {number|undefined} rotation Rotation. * @param {ol.Coordinate=} opt_anchor Anchor coordinate. * @param {number=} opt_duration Duration. */ -ol.interaction.Interaction.rotate = function(map, view, rotation, opt_anchor, opt_duration) { +ol.interaction.Interaction.rotate = function(view, rotation, opt_anchor, opt_duration) { rotation = view.constrainRotation(rotation, 0); ol.interaction.Interaction.rotateWithoutConstraints( - map, view, rotation, opt_anchor, opt_duration); + view, rotation, opt_anchor, opt_duration); }; /** - * @param {ol.Map} map Map. * @param {ol.View} view View. * @param {number|undefined} rotation Rotation. * @param {ol.Coordinate=} opt_anchor Anchor coordinate. * @param {number=} opt_duration Duration. */ -ol.interaction.Interaction.rotateWithoutConstraints = function(map, view, rotation, opt_anchor, opt_duration) { +ol.interaction.Interaction.rotateWithoutConstraints = function(view, rotation, opt_anchor, opt_duration) { if (rotation !== undefined) { var currentRotation = view.getRotation(); var currentCenter = view.getCenter(); @@ -154,7 +151,6 @@ ol.interaction.Interaction.rotateWithoutConstraints = function(map, view, rotati /** - * @param {ol.Map} map Map. * @param {ol.View} view View. * @param {number|undefined} resolution Resolution to go to. * @param {ol.Coordinate=} opt_anchor Anchor coordinate. @@ -168,36 +164,34 @@ ol.interaction.Interaction.rotateWithoutConstraints = function(map, view, rotati * will select the nearest resolution. If not defined 0 is * assumed. */ -ol.interaction.Interaction.zoom = function(map, view, resolution, opt_anchor, opt_duration, opt_direction) { +ol.interaction.Interaction.zoom = function(view, resolution, opt_anchor, opt_duration, opt_direction) { resolution = view.constrainResolution(resolution, 0, opt_direction); ol.interaction.Interaction.zoomWithoutConstraints( - map, view, resolution, opt_anchor, opt_duration); + view, resolution, opt_anchor, opt_duration); }; /** - * @param {ol.Map} map Map. * @param {ol.View} view View. * @param {number} delta Delta from previous zoom level. * @param {ol.Coordinate=} opt_anchor Anchor coordinate. * @param {number=} opt_duration Duration. */ -ol.interaction.Interaction.zoomByDelta = function(map, view, delta, opt_anchor, opt_duration) { +ol.interaction.Interaction.zoomByDelta = function(view, delta, opt_anchor, opt_duration) { var currentResolution = view.getResolution(); var resolution = view.constrainResolution(currentResolution, delta, 0); ol.interaction.Interaction.zoomWithoutConstraints( - map, view, resolution, opt_anchor, opt_duration); + view, resolution, opt_anchor, opt_duration); }; /** - * @param {ol.Map} map Map. * @param {ol.View} view View. * @param {number|undefined} resolution Resolution to go to. * @param {ol.Coordinate=} opt_anchor Anchor coordinate. * @param {number=} opt_duration Duration. */ -ol.interaction.Interaction.zoomWithoutConstraints = function(map, view, resolution, opt_anchor, opt_duration) { +ol.interaction.Interaction.zoomWithoutConstraints = function(view, resolution, opt_anchor, opt_duration) { if (resolution) { var currentResolution = view.getResolution(); var currentCenter = view.getCenter(); diff --git a/src/ol/interaction/keyboardpan.js b/src/ol/interaction/keyboardpan.js index 55541c85a4..efb3c3fb94 100644 --- a/src/ol/interaction/keyboardpan.js +++ b/src/ol/interaction/keyboardpan.js @@ -100,7 +100,7 @@ ol.interaction.KeyboardPan.handleEvent = function(mapBrowserEvent) { } var delta = [deltaX, deltaY]; ol.coordinate.rotate(delta, view.getRotation()); - ol.interaction.Interaction.pan(map, view, delta, this.duration_); + ol.interaction.Interaction.pan(view, delta, this.duration_); mapBrowserEvent.preventDefault(); stopEvent = true; } diff --git a/src/ol/interaction/keyboardzoom.js b/src/ol/interaction/keyboardzoom.js index e169190c2e..856376cef4 100644 --- a/src/ol/interaction/keyboardzoom.js +++ b/src/ol/interaction/keyboardzoom.js @@ -75,7 +75,7 @@ ol.interaction.KeyboardZoom.handleEvent = function(mapBrowserEvent) { var delta = (charCode == '+'.charCodeAt(0)) ? this.delta_ : -this.delta_; var view = map.getView(); ol.interaction.Interaction.zoomByDelta( - map, view, delta, undefined, this.duration_); + view, delta, undefined, this.duration_); mapBrowserEvent.preventDefault(); stopEvent = true; } diff --git a/src/ol/interaction/mousewheelzoom.js b/src/ol/interaction/mousewheelzoom.js index 4153369c55..98039aa36e 100644 --- a/src/ol/interaction/mousewheelzoom.js +++ b/src/ol/interaction/mousewheelzoom.js @@ -237,7 +237,7 @@ ol.interaction.MouseWheelZoom.prototype.handleWheelZoom_ = function(map) { } var maxDelta = ol.MOUSEWHEELZOOM_MAXDELTA; var delta = ol.math.clamp(this.delta_, -maxDelta, maxDelta); - ol.interaction.Interaction.zoomByDelta(map, view, -delta, this.lastAnchor_, + ol.interaction.Interaction.zoomByDelta(view, -delta, this.lastAnchor_, this.duration_); this.mode_ = undefined; this.delta_ = 0; diff --git a/src/ol/interaction/pinchrotate.js b/src/ol/interaction/pinchrotate.js index 1289c3dfcf..c432580183 100644 --- a/src/ol/interaction/pinchrotate.js +++ b/src/ol/interaction/pinchrotate.js @@ -110,7 +110,7 @@ ol.interaction.PinchRotate.handleDragEvent_ = function(mapBrowserEvent) { var view = map.getView(); var rotation = view.getRotation(); map.render(); - ol.interaction.Interaction.rotateWithoutConstraints(map, view, + ol.interaction.Interaction.rotateWithoutConstraints(view, rotation + rotationDelta, this.anchor_); } }; @@ -130,7 +130,7 @@ ol.interaction.PinchRotate.handleUpEvent_ = function(mapBrowserEvent) { if (this.rotating_) { var rotation = view.getRotation(); ol.interaction.Interaction.rotate( - map, view, rotation, this.anchor_, this.duration_); + view, rotation, this.anchor_, this.duration_); } return false; } else { diff --git a/src/ol/interaction/pinchzoom.js b/src/ol/interaction/pinchzoom.js index f7c24961aa..3d42390f2e 100644 --- a/src/ol/interaction/pinchzoom.js +++ b/src/ol/interaction/pinchzoom.js @@ -99,7 +99,7 @@ ol.interaction.PinchZoom.handleDragEvent_ = function(mapBrowserEvent) { // scale, bypass the resolution constraint map.render(); ol.interaction.Interaction.zoomWithoutConstraints( - map, view, resolution * scaleDelta, this.anchor_); + view, resolution * scaleDelta, this.anchor_); }; @@ -122,7 +122,7 @@ ol.interaction.PinchZoom.handleUpEvent_ = function(mapBrowserEvent) { // direction not to zoom out/in if user was pinching in/out. // Direction is > 0 if pinching out, and < 0 if pinching in. var direction = this.lastScaleDelta_ - 1; - ol.interaction.Interaction.zoom(map, view, resolution, + ol.interaction.Interaction.zoom(view, resolution, this.anchor_, this.duration_, direction); } return false; diff --git a/test/spec/ol/interaction/keyboardpan.test.js b/test/spec/ol/interaction/keyboardpan.test.js index 74aa16aa4f..f27fe81cd1 100644 --- a/test/spec/ol/interaction/keyboardpan.test.js +++ b/test/spec/ol/interaction/keyboardpan.test.js @@ -40,10 +40,10 @@ describe('ol.interaction.KeyboardPan', function() { map.handleMapBrowserEvent(event); event.originalEvent.keyCode = 39; // RIGHT map.handleMapBrowserEvent(event); - expect(spy.getCall(0).args[2]).to.eql([0, -128]); - expect(spy.getCall(1).args[2]).to.eql([0, 128]); - expect(spy.getCall(2).args[2]).to.eql([-128, 0]); - expect(spy.getCall(3).args[2]).to.eql([128, 0]); + expect(spy.getCall(0).args[1]).to.eql([0, -128]); + 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(); }); }); diff --git a/test/spec/ol/interaction/keyboardzoom.test.js b/test/spec/ol/interaction/keyboardzoom.test.js index 6acff82601..1816d2bbdd 100644 --- a/test/spec/ol/interaction/keyboardzoom.test.js +++ b/test/spec/ol/interaction/keyboardzoom.test.js @@ -36,8 +36,8 @@ describe('ol.interaction.KeyboardZoom', function() { map.handleMapBrowserEvent(event); event.originalEvent.charCode = '-'.charCodeAt(0); map.handleMapBrowserEvent(event); - expect(spy.getCall(0).args[2]).to.eql(1); - expect(spy.getCall(1).args[2]).to.eql(-1); + expect(spy.getCall(0).args[1]).to.eql(1); + expect(spy.getCall(1).args[1]).to.eql(-1); ol.interaction.Interaction.zoomByDelta.restore(); }); }); diff --git a/test/spec/ol/interaction/mousewheelzoom.test.js b/test/spec/ol/interaction/mousewheelzoom.test.js index ea3078d1a0..fff878805d 100644 --- a/test/spec/ol/interaction/mousewheelzoom.test.js +++ b/test/spec/ol/interaction/mousewheelzoom.test.js @@ -106,8 +106,8 @@ describe('ol.interaction.MouseWheelZoom', function() { it('works in DOM_DELTA_LINE mode (wheel)', function(done) { var spy = sinon.spy(ol.interaction.Interaction, 'zoomByDelta'); map.once('postrender', function() { - expect(spy.getCall(0).args[2]).to.be(-1); - expect(spy.getCall(0).args[3]).to.eql([0, 0]); + expect(spy.getCall(0).args[1]).to.be(-1); + expect(spy.getCall(0).args[2]).to.eql([0, 0]); ol.interaction.Interaction.zoomByDelta.restore(); done(); }); @@ -127,8 +127,8 @@ describe('ol.interaction.MouseWheelZoom', function() { ol.has.SAFARI = true; var spy = sinon.spy(ol.interaction.Interaction, 'zoomByDelta'); map.once('postrender', function() { - expect(spy.getCall(0).args[2]).to.be(-1); - expect(spy.getCall(0).args[3]).to.eql([0, 0]); + expect(spy.getCall(0).args[1]).to.be(-1); + expect(spy.getCall(0).args[2]).to.eql([0, 0]); ol.interaction.Interaction.zoomByDelta.restore(); ol.has.SAFARI = origHasSafari; done(); @@ -148,8 +148,8 @@ describe('ol.interaction.MouseWheelZoom', function() { ol.has.SAFARI = false; var spy = sinon.spy(ol.interaction.Interaction, 'zoomByDelta'); map.once('postrender', function() { - expect(spy.getCall(0).args[2]).to.be(-1); - expect(spy.getCall(0).args[3]).to.eql([0, 0]); + expect(spy.getCall(0).args[1]).to.be(-1); + expect(spy.getCall(0).args[2]).to.eql([0, 0]); ol.interaction.Interaction.zoomByDelta.restore(); ol.has.SAFARI = origHasSafari; done();