Map: defaults controls should include TouchNavigation if present

This commit is contained in:
Peter Robins
2012-03-06 10:08:19 +00:00
parent d5da1130b5
commit 93028bbcf8
+10 -7
View File
@@ -193,8 +193,8 @@ OpenLayers.Map = OpenLayers.Class({
* {Array(<OpenLayers.Control>)} List of controls associated with the map. * {Array(<OpenLayers.Control>)} List of controls associated with the map.
* *
* If not provided in the map options at construction, the map will * If not provided in the map options at construction, the map will
* be given the following controls by default: * by default be given the following controls if present in the build:
* - <OpenLayers.Control.Navigation> * - <OpenLayers.Control.Navigation> or <OpenLayers.Control.TouchNavigation>
* - <OpenLayers.Control.PanZoom> * - <OpenLayers.Control.PanZoom>
* - <OpenLayers.Control.ArgParser> * - <OpenLayers.Control.ArgParser>
* - <OpenLayers.Control.Attribution> * - <OpenLayers.Control.Attribution>
@@ -588,20 +588,23 @@ OpenLayers.Map = OpenLayers.Class({
} }
} }
if (this.controls == null) { if (this.controls == null) { // default controls
this.controls = []; this.controls = [];
if (OpenLayers.Control != null) { // running full or lite? if (OpenLayers.Control != null) { // running full or lite?
// Navigation or TouchNavigation depending on what is in build
if (OpenLayers.Control.Navigation) { if (OpenLayers.Control.Navigation) {
this.controls.push(new OpenLayers.Control.Navigation()) this.controls.push(new OpenLayers.Control.Navigation());
} else if (OpenLayers.Control.TouchNavigation) {
this.controls.push(new OpenLayers.Control.TouchNavigation());
} }
if (OpenLayers.Control.PanZoom) { if (OpenLayers.Control.PanZoom) {
this.controls.push(new OpenLayers.Control.PanZoom()) this.controls.push(new OpenLayers.Control.PanZoom());
} }
if (OpenLayers.Control.ArgParser) { if (OpenLayers.Control.ArgParser) {
this.controls.push(new OpenLayers.Control.ArgParser()) this.controls.push(new OpenLayers.Control.ArgParser());
} }
if (OpenLayers.Control.Attribution) { if (OpenLayers.Control.Attribution) {
this.controls.push(new OpenLayers.Control.Attribution()) this.controls.push(new OpenLayers.Control.Attribution());
} }
} }
} }