[Commits] r1056 - apps/opengeo/geoexplorer/branches/0.1.x/lib

commits at geoext.org commits at geoext.org
Fri Jun 12 00:48:34 CEST 2009


Author: tschaub
Date: 2009-06-12 00:48:34 +0200 (Fri, 12 Jun 2009)
New Revision: 1056

Modified:
   apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer.js
Log:
Only allow removal of layers if the map has more than one non-vector layer.

Modified: apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer.js
===================================================================
--- apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer.js	2009-06-11 22:37:49 UTC (rev 1055)
+++ apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer.js	2009-06-11 22:48:34 UTC (rev 1056)
@@ -261,8 +261,15 @@
             selModel: new Ext.tree.DefaultSelectionModel({
                 listeners: {
                     beforeselect: function() {
-                        removeLayerAction.enable();
-                    }
+                        // allow removal if more than one non-vector layer
+                        var count = this.mapPanel.layers.queryBy(function(r) {
+                            return !(r.get("layer") instanceof OpenLayers.Layer.Vector);
+                        }).getCount();
+                        if(count > 1) {
+                            removeLayerAction.enable();
+                        }
+                    },
+                    scope: this
                 }
             }),
             listeners: {



More information about the Commits mailing list