Index: trunk/extensions/Maps/OpenStreetMap/OSMFunctions.js |
— | — | @@ -75,7 +75,7 @@ |
76 | 76 | |
77 | 77 | return false; |
78 | 78 | } |
79 | | - |
| 79 | + |
80 | 80 | function slippymap_map(mapId, mapParams) { |
81 | 81 | var self = this; |
82 | 82 | this.mapId = mapId; |
— | — | @@ -85,17 +85,23 @@ |
86 | 86 | |
87 | 87 | // Add the controls |
88 | 88 | this.mapOptions = {controls: []}; |
89 | | - |
| 89 | + |
90 | 90 | for (i in this.controls) { |
91 | | - if (this.controls[i].toLowerCase() == 'autopanzoom') { |
92 | | - if (this.height > 140) this.controls[i] = this.height > 320 ? 'panzoombar' : 'panzoom'; |
93 | | - } |
94 | | - |
95 | | - control = getValidControlName(this.controls[i]); |
96 | | - |
97 | | - if (control) { |
98 | | - eval(' this.mapOptions.controls.push( new OpenLayers.Control.' + control + '() ); '); |
| 91 | + if (typeof controls[i] == 'string') { |
| 92 | + if (this.controls[i].toLowerCase() == 'autopanzoom') { |
| 93 | + if (this.height > 140) this.controls[i] = this.height > 320 ? 'panzoombar' : 'panzoom'; |
| 94 | + } |
| 95 | + |
| 96 | + control = getValidControlName(this.controls[i]); |
| 97 | + |
| 98 | + if (control) { |
| 99 | + eval(' this.mapOptions.controls.push( new OpenLayers.Control.' + control + '() ); '); |
| 100 | + } |
99 | 101 | } |
| 102 | + else { |
| 103 | + this.mapOptions.controls.push(controls[i]); // If a control is provided, instead a string, just add it |
| 104 | + controls[i].activate(); // And activate it |
| 105 | + } |
100 | 106 | } |
101 | 107 | } |
102 | 108 | |