Move pixel/coordinate matrices into frame state, remove canRotate

This commit is contained in:
Tom Payne
2013-01-12 23:56:13 +01:00
parent a927385e72
commit 9764e76975
9 changed files with 71 additions and 133 deletions
+1 -3
View File
@@ -43,9 +43,7 @@ ol.interaction.DragPan.prototype.handleDrag = function(mapBrowserEvent) {
var rotation = view.getRotation();
var delta =
new ol.Coordinate(-resolution * this.deltaX, resolution * this.deltaY);
if (map.canRotate() && goog.isDef(rotation)) {
delta.rotate(rotation);
}
delta.rotate(rotation);
var newCenter = new ol.Coordinate(
this.startCenter.x + delta.x, this.startCenter.y + delta.y);
map.requestRenderFrame();
@@ -73,7 +73,7 @@ ol.interaction.DragRotateAndZoom.prototype.handleDragStart =
var browserEvent = mapBrowserEvent.browserEvent;
var map = mapBrowserEvent.map;
var view = map.getView().getView2D();
if (map.canRotate() && this.condition_(browserEvent)) {
if (this.condition_(browserEvent)) {
var resolution = view.getResolution();
var size = map.getSize();
var delta = new goog.math.Vec2(
+1 -2
View File
@@ -61,8 +61,7 @@ ol.interaction.DragRotate.prototype.handleDragStart =
// FIXME supports View2D only
var view = map.getView();
goog.asserts.assert(view instanceof ol.View2D);
if (browserEvent.isMouseActionButton() && this.condition_(browserEvent) &&
map.canRotate()) {
if (browserEvent.isMouseActionButton() && this.condition_(browserEvent)) {
map.requestRenderFrame();
var size = map.getSize();
var offset = mapBrowserEvent.getPixel();
+2 -6
View File
@@ -70,12 +70,8 @@ ol.interaction.DragZoom.prototype.handleDragEnd =
goog.asserts.assert(view instanceof ol.View2D);
var mapSize = /** @type {ol.Size} */ (map.getSize());
view.fitExtent(extent, mapSize);
if (map.canRotate()) {
// FIXME we don't set the rotation if the map doesn't
// support rotation, this will prevent any map using
// that view from rotating, which may not be desired
view.setRotation(0);
}
// FIXME we should preserve rotation
view.setRotation(0);
});
}
};