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:
@@ -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;
|
||||
};
|
||||
Reference in New Issue
Block a user