diff --git a/demos/side-by-side/index.html.in b/demos/side-by-side/index.html.in index 1865bc9f00..0e9ced36a5 100644 --- a/demos/side-by-side/index.html.in +++ b/demos/side-by-side/index.html.in @@ -67,7 +67,6 @@

Notes: The two maps share the same center, resolution, rotation and layers. Currently the DOM map does not support rotation.

Console tips: If you want to play around with the API in the console, first make sure that you're using the simple optimizations version of this demo, then open a console and experiment with the domMap, webglMap and layer variables in the console. The source code is in side-by-side.js.

-

Known bugs: When the map is rotated, panning on the WebGL map doesn't work as expected.

diff --git a/src/ol/interaction/dragpan.js b/src/ol/interaction/dragpan.js index 9fe4639823..4e7b40ab5b 100644 --- a/src/ol/interaction/dragpan.js +++ b/src/ol/interaction/dragpan.js @@ -1,5 +1,3 @@ -// FIXME cope with rotation - goog.provide('ol.interaction.DragPan'); goog.require('ol.Coordinate'); @@ -26,8 +24,12 @@ goog.inherits(ol.interaction.DragPan, ol.interaction.Drag); ol.interaction.DragPan.prototype.handleDrag = function(mapBrowserEvent) { var map = mapBrowserEvent.map; var resolution = map.getResolution(); + var rotation = map.getRotation(); var delta = new ol.Coordinate(-resolution * this.deltaX, resolution * this.deltaY); + if (map.canRotate() && goog.isDef(rotation)) { + delta.rotate(rotation); + } this.pan(map, delta, this.startCenter); };