[Commits] r1762 - sandbox/cmoullet/ux/Redlining/examples

commits at geoext.org commits at geoext.org
Sun Jan 17 13:28:05 CET 2010


Author: cmoullet
Date: 2010-01-17 13:28:05 +0100 (Sun, 17 Jan 2010)
New Revision: 1762

Modified:
   sandbox/cmoullet/ux/Redlining/examples/StylingExample.html
Log:
keep label, not fully functional on IE

Modified: sandbox/cmoullet/ux/Redlining/examples/StylingExample.html
===================================================================
--- sandbox/cmoullet/ux/Redlining/examples/StylingExample.html	2010-01-17 06:26:54 UTC (rev 1761)
+++ sandbox/cmoullet/ux/Redlining/examples/StylingExample.html	2010-01-17 12:28:05 UTC (rev 1762)
@@ -39,7 +39,8 @@
             vectorLayer.addFeatures([labelFeature]);
 
             // Modify label feature
-            labelFeature.style.label = 'text modified';
+            labelFeature.attributes.name = 'text modified'
+            labelFeature.style.label = labelFeature.attributes.name;
 
             vectorLayer.redraw();
 
@@ -66,8 +67,8 @@
             var externalGraphic = new Image();
             externalGraphic.src = 'http://www.thingsaregood.com/wp-content/uploads/2007/11/wonderful-bike-icon.png';
             externalGraphic.onload = function() {
-                myMarkerSymbolizer.graphicWidth = externalGraphic.width / 2;
-                myMarkerSymbolizer.graphicHeight = externalGraphic.height / 2;
+                myMarkerSymbolizer.graphicWidth = externalGraphic.width / 3;
+                myMarkerSymbolizer.graphicHeight = externalGraphic.height / 3;
                 myMarkerSymbolizer.graphicOpacity = 1;
                 myMarkerSymbolizer.externalGraphic = externalGraphic.src;
 
@@ -81,6 +82,33 @@
                         OpenLayers.Feature.Vector.style["select"])
             });
             map.addControl(select);
+            select.onBeforeSelect = function(feature) {
+                this.selectStyle.fill = true;
+                this.selectStyle.stroke = true;
+                this.selectStyle.fillColor = '#FF0000';
+                this.selectStyle.pointRadius = 12;
+                if (feature.style.label) {
+                    this.selectStyle.label = feature.attributes.name;
+                }
+                if (feature.style.externalGraphic) {
+                    this.selectStyle.externalGraphic = feature.style.externalGraphic;
+                    this.selectStyle.graphicWidth = feature.style.graphicWidth;
+                    this.selectStyle.graphicHeight = feature.style.graphicHeight;
+                    this.selectStyle.graphicOpacity = feature.style.graphicOpacity / 2;
+
+                }
+            };
+            select.onUnselect = function(feature) {
+                this.selectStyle.label = null;
+                this.selectStyle.externalGraphic = null;
+                this.selectStyle.graphicWidth = null;
+                this.selectStyle.graphicHeight = null;
+                this.selectStyle.graphicOpacity = null;
+                this.selectStyle.fillColor = null;
+                this.selectStyle.pointRadius = null;
+                this.selectStyle.fill = null;
+                this.selectStyle.stroke = null;
+            };
             select.activate();
         }
     </script>



More information about the Commits mailing list