Redefine ol.Coordinate to be Array.<number>
This commit is contained in:
@@ -3,12 +3,12 @@
|
||||
goog.provide('ol.interaction.DragPan');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Kinetic');
|
||||
goog.require('ol.Pixel');
|
||||
goog.require('ol.PreRenderFunction');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.ViewHint');
|
||||
goog.require('ol.coordinate');
|
||||
goog.require('ol.interaction.ConditionType');
|
||||
goog.require('ol.interaction.Drag');
|
||||
|
||||
@@ -61,11 +61,9 @@ ol.interaction.DragPan.prototype.handleDrag = function(mapBrowserEvent) {
|
||||
goog.asserts.assert(view instanceof ol.View2D);
|
||||
var resolution = view.getResolution();
|
||||
var rotation = view.getRotation();
|
||||
var delta =
|
||||
new ol.Coordinate(-resolution * this.deltaX, resolution * this.deltaY);
|
||||
delta.rotate(rotation);
|
||||
var newCenter = new ol.Coordinate(
|
||||
this.startCenter.x + delta.x, this.startCenter.y + delta.y);
|
||||
var newCenter = [-resolution * this.deltaX, resolution * this.deltaY];
|
||||
ol.coordinate.rotate(newCenter, rotation);
|
||||
ol.coordinate.add(newCenter, this.startCenter);
|
||||
map.requestRenderFrame();
|
||||
view.setCenter(newCenter);
|
||||
};
|
||||
|
||||
@@ -4,8 +4,8 @@ goog.provide('ol.interaction.KeyboardPan');
|
||||
|
||||
goog.require('goog.events.KeyCodes');
|
||||
goog.require('goog.events.KeyHandler.EventType');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.coordinate');
|
||||
goog.require('ol.interaction.Interaction');
|
||||
|
||||
|
||||
@@ -67,8 +67,8 @@ ol.interaction.KeyboardPan.prototype.handleMapBrowserEvent =
|
||||
} else {
|
||||
deltaY = mapUnitsDelta;
|
||||
}
|
||||
var delta = new ol.Coordinate(deltaX, deltaY);
|
||||
delta.rotate(rotation);
|
||||
var delta = [deltaX, deltaY];
|
||||
ol.coordinate.rotate(delta, rotation);
|
||||
view.pan(map, delta, ol.interaction.KEYBOARD_PAN_DURATION);
|
||||
keyEvent.preventDefault();
|
||||
mapBrowserEvent.preventDefault();
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
goog.provide('ol.interaction.TouchPan');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Kinetic');
|
||||
goog.require('ol.Pixel');
|
||||
goog.require('ol.PreRenderFunction');
|
||||
goog.require('ol.View');
|
||||
goog.require('ol.ViewHint');
|
||||
goog.require('ol.coordinate');
|
||||
goog.require('ol.interaction.Touch');
|
||||
|
||||
|
||||
@@ -55,10 +55,10 @@ ol.interaction.TouchPan.prototype.handleTouchMove = function(mapBrowserEvent) {
|
||||
var deltaX = this.lastCentroid.x - centroid.x;
|
||||
var deltaY = centroid.y - this.lastCentroid.y;
|
||||
var view = mapBrowserEvent.map.getView();
|
||||
var center = new ol.Coordinate(deltaX, deltaY)
|
||||
.scale(view.getResolution())
|
||||
.rotate(view.getRotation())
|
||||
.add(view.getCenter());
|
||||
var center = [deltaX, deltaY];
|
||||
ol.coordinate.scale(center, view.getResolution());
|
||||
ol.coordinate.rotate(center, view.getRotation());
|
||||
ol.coordinate.add(center, view.getCenter());
|
||||
view.setCenter(center);
|
||||
}
|
||||
this.lastCentroid = centroid;
|
||||
|
||||
Reference in New Issue
Block a user