make the Navigation control support pinch-zoom, r=bbinet (closes #3273)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11961 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2011-05-09 08:28:35 +00:00
parent 00cfa5de55
commit e87e1c0c57
2 changed files with 54 additions and 1 deletions

View File

@@ -37,6 +37,18 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
*/
dragPanOptions: null,
/**
* Property: pinchZoom
* {<OpenLayers.Control.PinchZoom>}
*/
pinchZoom: null,
/**
* APIProperty: pinchZoomOptions
* {Object} Options passed to the PinchZoom control.
*/
pinchZoomOptions: null,
/**
* APIProperty: documentDrag
* {Boolean} Allow panning of the map by dragging outside map viewport.
@@ -124,6 +136,12 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
this.zoomBox.destroy();
}
this.zoomBox = null;
if (this.pinchZoom) {
this.pinchZoom.destroy();
}
this.pinchZoom = null;
OpenLayers.Control.prototype.destroy.apply(this,arguments);
},
@@ -139,6 +157,9 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
if (this.zoomBoxEnabled) {
this.zoomBox.activate();
}
if (this.pinchZoom) {
this.pinchZoom.activate();
}
return OpenLayers.Control.prototype.activate.apply(this,arguments);
},
@@ -146,6 +167,9 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
* Method: deactivate
*/
deactivate: function() {
if (this.pinchZoom) {
this.pinchZoom.deactivate();
}
this.zoomBox.deactivate();
this.dragPan.deactivate();
this.handlers.click.deactivate();
@@ -188,6 +212,11 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
this, {"up" : this.wheelUp,
"down": this.wheelDown},
this.mouseWheelOptions );
if (OpenLayers.Control.PinchZoom) {
this.pinchZoom = new OpenLayers.Control.PinchZoom(
OpenLayers.Util.extend(
{map: this.map}, this.pinchZoomOptions));
}
},
/**