Fix drag pan for rotated maps
This commit is contained in:
@@ -67,7 +67,6 @@
|
||||
</table>
|
||||
<p><b>Notes:</b> The two maps share the same center, resolution, rotation and layers. Currently the DOM map does not support rotation.</p>
|
||||
<p><b>Console tips:</b> If you want to play around with the API in the console, first make sure that you're using the <a href="simple-optimizations.html">simple optimizations version</a> of this demo, then open a console and experiment with the <code>domMap</code>, <code>webglMap</code> and <code>layer</code> variables in the console. The source code is in <a href="side-by-side.js">side-by-side.js</a>.</p>
|
||||
<p><b>Known bugs:</b> When the map is rotated, panning on the WebGL map doesn't work as expected.</p>
|
||||
<script src="@SRC@" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user