Merge all changes from the naturaldocs sandbox. This brings all the work that
has been done in the NaturalDocs branch back to trunk. Thanks to everyone who helped out in making this happen. (I could list people, but the list would be long, and I'm already mentally on vacation.) git-svn-id: http://svn.openlayers.org/trunk/openlayers@3545 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -3,25 +3,37 @@
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Control/ZoomBox.js
|
||||
* @requires OpenLayers/Control/DragPan.js
|
||||
* @requires OpenLayers/Handler/MouseWheel.js
|
||||
*
|
||||
* Class: OpenLayers.Control.Navigation
|
||||
*/
|
||||
OpenLayers.Control.Navigation = OpenLayers.Class.create();
|
||||
OpenLayers.Control.Navigation.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Control, {
|
||||
|
||||
/** @type OpenLayers.Control.ZoomBox */
|
||||
/**
|
||||
* Property: dragPan
|
||||
* {<OpenLayers.Control.ZoomBox>}
|
||||
*/
|
||||
dragPan: null,
|
||||
|
||||
/** @type OpenLayers.Control.ZoomBox */
|
||||
/**
|
||||
* Property: zoomBox
|
||||
* {<OpenLayers.Control.ZoomBox>}
|
||||
*/
|
||||
zoomBox: null,
|
||||
|
||||
/** @type OpenLayers.Handler.MouseWheel */
|
||||
/**
|
||||
* Property: wheelHandler
|
||||
* {<OpenLayers.Handler.MouseWheel>}
|
||||
*/
|
||||
wheelHandler: null,
|
||||
|
||||
/**
|
||||
* Method: activate
|
||||
*/
|
||||
activate: function() {
|
||||
this.dragPan.activate();
|
||||
this.wheelHandler.activate();
|
||||
@@ -29,6 +41,9 @@ OpenLayers.Control.Navigation.prototype =
|
||||
return OpenLayers.Control.prototype.activate.apply(this,arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: deactivate
|
||||
*/
|
||||
deactivate: function() {
|
||||
this.zoomBox.deactivate();
|
||||
this.dragPan.deactivate();
|
||||
@@ -36,6 +51,9 @@ OpenLayers.Control.Navigation.prototype =
|
||||
return OpenLayers.Control.prototype.deactivate.apply(this,arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: draw
|
||||
*/
|
||||
draw: function() {
|
||||
this.map.events.register( "dblclick", this, this.defaultDblClick );
|
||||
this.dragPan = new OpenLayers.Control.DragPan({map: this.map});
|
||||
@@ -50,8 +68,11 @@ OpenLayers.Control.Navigation.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Event} evt
|
||||
*/
|
||||
* Method: defaultDblClick
|
||||
*
|
||||
* Parameters:
|
||||
* evt - {Event}
|
||||
*/
|
||||
defaultDblClick: function (evt) {
|
||||
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );
|
||||
this.map.setCenter(newCenter, this.map.zoom + 1);
|
||||
@@ -59,6 +80,12 @@ OpenLayers.Control.Navigation.prototype =
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: wheelChange
|
||||
*
|
||||
* Parameters:
|
||||
* evt - {Event}
|
||||
*/
|
||||
wheelChange: function(evt, deltaZ) {
|
||||
var newZoom = this.map.getZoom() + deltaZ;
|
||||
if (!this.map.isValidZoomLevel(newZoom)) return;
|
||||
@@ -74,15 +101,23 @@ OpenLayers.Control.Navigation.prototype =
|
||||
this.map.setCenter( newCenter, newZoom );
|
||||
},
|
||||
|
||||
/** User spun scroll wheel up
|
||||
/**
|
||||
* Method: wheelUp
|
||||
* User spun scroll wheel up
|
||||
*
|
||||
* Parameters:
|
||||
* evt - {Event}
|
||||
*/
|
||||
wheelUp: function(evt) {
|
||||
this.wheelChange(evt, 1);
|
||||
},
|
||||
|
||||
/** User spun scroll wheel down
|
||||
/**
|
||||
* Method: wheelDown
|
||||
* User spun scroll wheel down
|
||||
*
|
||||
* Parameters:
|
||||
* evt - {Event}
|
||||
*/
|
||||
wheelDown: function(evt) {
|
||||
this.wheelChange(evt, -1);
|
||||
|
||||
Reference in New Issue
Block a user