[fusion-commits] r2451 - in trunk: lib widgets

svn_fusion at osgeo.org svn_fusion at osgeo.org
Tue Nov 8 16:06:19 EST 2011


Author: madair
Date: 2011-11-08 13:06:19 -0800 (Tue, 08 Nov 2011)
New Revision: 2451

Modified:
   trunk/lib/Widget.js
   trunk/widgets/Measure.js
   trunk/widgets/Select.js
   trunk/widgets/SelectPolygon.js
   trunk/widgets/Zoom.js
Log:
re #480: make sure that widgets each have a unique ID so that it is easier to identify specific instances of a qidget for the 'shouldActivateWith' function.  (Multiple widgets of same type that include a path handler is the problem.)



Modified: trunk/lib/Widget.js
===================================================================
--- trunk/lib/Widget.js	2011-11-08 20:17:34 UTC (rev 2450)
+++ trunk/lib/Widget.js	2011-11-08 21:06:19 UTC (rev 2451)
@@ -46,6 +46,7 @@
     group: null,
     domObj: null,
     uiClass: null,
+    widgetUniqueId: null,
     
     /**
      * initialize the widget
@@ -79,6 +80,7 @@
         //check to see if this widget is associated with a specific Map
         var json = widgetTag.extension;
         this.widgetLayerId = json.WidgetLayerId ? json.WidgetLayerId[0] : null;
+        this.widgetUniqueId = OpenLayers.Util.createUniqueID("FusionWidget_");
         
         this.initializeWidget(widgetTag);
     },

Modified: trunk/widgets/Measure.js
===================================================================
--- trunk/widgets/Measure.js	2011-11-08 20:17:34 UTC (rev 2450)
+++ trunk/widgets/Measure.js	2011-11-08 21:06:19 UTC (rev 2451)
@@ -238,11 +238,12 @@
     },
 
     shouldActivateWith: function(widget) {
-        return (widget instanceof Fusion.Widget.Measure &&
-                widget.measureType == this.measureType);
+        return (widget instanceof Fusion.Widget.SelectPolygon &&
+                widget.widgetUniqueId == this.widgetUniqueId);
+        
     },
+    
 
-
     measure: function(stats) {
         this.hasMeasure = true;
         /* rebuild distance markers */

Modified: trunk/widgets/Select.js
===================================================================
--- trunk/widgets/Select.js	2011-11-08 20:17:34 UTC (rev 2450)
+++ trunk/widgets/Select.js	2011-11-08 21:06:19 UTC (rev 2451)
@@ -84,10 +84,11 @@
     },
 
     shouldActivateWith: function(widget) {
-        return (widget instanceof Fusion.Widget.Select &&
-                widget.bActiveOnly == this.bActiveOnly);
+        return (widget instanceof Fusion.Widget.SelectPolygon &&
+                widget.widgetUniqueId == this.widgetUniqueId);
         
     },
+    
     enable: function() {
         if (this.bActiveOnly) {
             var layer = this.getMap().getActiveLayer();

Modified: trunk/widgets/SelectPolygon.js
===================================================================
--- trunk/widgets/SelectPolygon.js	2011-11-08 20:17:34 UTC (rev 2450)
+++ trunk/widgets/SelectPolygon.js	2011-11-08 21:06:19 UTC (rev 2451)
@@ -63,6 +63,12 @@
         mapWidget.handlers.push(this.handler);
     },
     
+    shouldActivateWith: function(widget) {
+        return (widget instanceof Fusion.Widget.SelectPolygon &&
+                widget.widgetUniqueId == this.widgetUniqueId);
+        
+    },
+    
     /**
      * activate the widget (listen to mouse events and change cursor)
      * This function should be defined for all functions that register
@@ -110,6 +116,7 @@
         }
         
         this.getMap().query(options);
+        return false;
     },
     
     setParameter: function(param, value) {

Modified: trunk/widgets/Zoom.js
===================================================================
--- trunk/widgets/Zoom.js	2011-11-08 20:17:34 UTC (rev 2450)
+++ trunk/widgets/Zoom.js	2011-11-08 21:06:19 UTC (rev 2451)
@@ -66,10 +66,9 @@
     },
     
     shouldActivateWith: function(widget) {
-        return (widget instanceof Fusion.Widget.Zoom &&
-                widget.zoomIn == this.zoomIn &&
-                widget.factor == this.factor &&
-                widget.tolerance == this.tolerance);
+        return (widget instanceof Fusion.Widget.SelectPolygon &&
+                widget.widgetUniqueId == this.widgetUniqueId);
+        
     },
     
    /**



More information about the fusion-commits mailing list