Navigation control with Drag sequence Dragger

This is totally unfinished, but tests pass, and it is only meant to give the map a Navigation control.
This commit is contained in:
ahocevar
2012-06-21 14:08:30 +02:00
parent 8fc1e9cc98
commit 6213e07f96
9 changed files with 198 additions and 97 deletions

View File

@@ -5,7 +5,7 @@ goog.require('ol.control.Control');
/**
* @constructor
* @extends ol.control.Control
* @extends {ol.control.Control}
* @param {boolean|undefined} opt_autoActivate
*/
ol.control.Navigation = function(opt_autoActivate) {
@@ -19,6 +19,18 @@ ol.control.Navigation = function(opt_autoActivate) {
*/
this.autoActivate_ =
goog.isDef(opt_autoActivate) ? opt_autoActivate : true;
/**
* type {number}
* @private
*/
this.oldX = undefined;
/**
* type {number}
* @private
*/
this.oldY = undefined;
};
goog.inherits(ol.control.Navigation, ol.control.Control);
@@ -45,5 +57,7 @@ ol.control.Navigation.prototype.deactivate = function() {
* @param {Event} evt
*/
ol.control.Navigation.prototype.moveMap = function(evt) {
this.getMap().moveByPx(evt.dx, evt.xy);
this.getMap().moveByPx(evt.clientX - oldX, evt.clientY - oldY);
oldX = evt.clientX;
oldY = evt.clientY;
};