From 27e5aaf8f0ff2b7c0d0d908ebaedae0b01e3d035 Mon Sep 17 00:00:00 2001 From: Peter Robins Date: Sat, 25 Feb 2012 17:06:30 +0000 Subject: [PATCH] Map: check default controls are in build --- lib/OpenLayers/Map.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 0a8f7bde0a..15b3bb03dd 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -577,14 +577,20 @@ OpenLayers.Map = OpenLayers.Class({ } if (this.controls == null) { + this.controls = []; if (OpenLayers.Control != null) { // running full or lite? - this.controls = [ new OpenLayers.Control.Navigation(), - new OpenLayers.Control.PanZoom(), - new OpenLayers.Control.ArgParser(), - new OpenLayers.Control.Attribution() - ]; - } else { - this.controls = []; + if (OpenLayers.Control.Navigation) { + this.controls.push(new OpenLayers.Control.Navigation()) + } + if (OpenLayers.Control.PanZoom) { + this.controls.push(new OpenLayers.Control.PanZoom()) + } + if (OpenLayers.Control.ArgParser) { + this.controls.push(new OpenLayers.Control.ArgParser()) + } + if (OpenLayers.Control.Attribution) { + this.controls.push(new OpenLayers.Control.Attribution()) + } } }