<div dir="ltr">Hello all, I'm trying to get my custom StyleMap to work with the Modify Feature example that comes with OpenLayers 2.12. Without the label attribute it seems to work fine in IE 8.0.7601 (I can select and drag the features around), but with the label being displayed I can sometimes select, but not modify the features. Any ideas? <br>
<br>I know, I know, upgrade my browser. Unfortunately that's not an option. <br><br>Thanks in advance. Below is the relevant code:<br><br>var map, vectors, controls;<br>        function init(){<br>            map = new OpenLayers.Map('map');<br>
            var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS", <br>                "<a href="http://vmap0.tiles.osgeo.org/wms/vmap0">http://vmap0.tiles.osgeo.org/wms/vmap0</a>?", {layers: 'basic'}); <br>
<br>            var myStyles = new OpenLayers.StyleMap({<br>                "default": new OpenLayers.Style({<br>                    label:'ASDF',<br>                    strokeColor: "#00FF00",<br>
                    strokeOpacity: 1,<br>                    strokeWidth: 3,<br>                    fillColor: "#FF5500",<br>                    fillOpacity: 0.5,<br>                    pointRadius: 6,<br>                    pointerEvents: "visiblePainted"<br>
                })<br>            });<br>            var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;<br>            renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;<br>
<br>            vectors = new OpenLayers.Layer.Vector("Vector Layer", {<br>                renderers: renderer,<br>                styleMap: myStyles<br>            });<br><br>            map.addLayers([wms, vectors]);<br>
            map.addControl(new OpenLayers.Control.LayerSwitcher());<br>            map.addControl(new OpenLayers.Control.MousePosition());<br>            <br>            controls = {<br>                point: new OpenLayers.Control.DrawFeature(vectors,<br>
                            OpenLayers.Handler.Point),<br>                line: new OpenLayers.Control.DrawFeature(vectors,<br>                            OpenLayers.Handler.Path),<br>                polygon: new OpenLayers.Control.DrawFeature(vectors,<br>
                            OpenLayers.Handler.Polygon),<br>                regular: new OpenLayers.Control.DrawFeature(vectors,<br>                            OpenLayers.Handler.RegularPolygon,<br>                            {handlerOptions: {sides: 5}}),<br>
                modify: new OpenLayers.Control.ModifyFeature(vectors)<br>            };<br>            <br>            for(var key in controls) {<br>                map.addControl(controls[key]);<br>            }<br>            <br>
            map.setCenter(new OpenLayers.LonLat(0, 0), 3);<br>            document.getElementById('noneToggle').checked = true;<br>        }<br>        <br>        function update() {<br>            // reset modification mode<br>
            controls.modify.mode = OpenLayers.Control.ModifyFeature.RESHAPE;<br>            var rotate = document.getElementById("rotate").checked;<br>            if(rotate) {<br>                controls.modify.mode |= OpenLayers.Control.ModifyFeature.ROTATE;<br>
            }<br>            var resize = document.getElementById("resize").checked;<br>            if(resize) {<br>                controls.modify.mode |= OpenLayers.Control.ModifyFeature.RESIZE;<br>                var keepAspectRatio = document.getElementById("keepAspectRatio").checked;<br>
                if (keepAspectRatio) {<br>                    controls.modify.mode &= ~OpenLayers.Control.ModifyFeature.RESHAPE;<br>                }<br>            }<br>            var drag = document.getElementById("drag").checked;<br>
            if(drag) {<br>                controls.modify.mode |= OpenLayers.Control.ModifyFeature.DRAG;<br>            }<br>            if (rotate || drag) {<br>                controls.modify.mode &= ~OpenLayers.Control.ModifyFeature.RESHAPE;<br>
            }<br>            controls.modify.createVertices = document.getElementById("createVertices").checked;<br>            var sides = parseInt(document.getElementById("sides").value);<br>            sides = Math.max(3, isNaN(sides) ? 0 : sides);<br>
            controls.regular.handler.sides = sides;<br>            var irregular =  document.getElementById("irregular").checked;<br>            controls.regular.handler.irregular = irregular;<br>        }<br><br>
        function toggleControl(element) {<br>            for(key in controls) {<br>                var control = controls[key];<br>                if(element.value == key && element.checked) {<br>                    control.activate();<br>
                } else {<br>                    control.deactivate();<br>                }<br>            }<br>        }<br clear="all"><div><br>-- <br><div style="text-align:left"><b>HYX</b> </div><div style="text-align:left">
<a href="http://hyx-music.com" target="_blank">http://hyx-music.com</a></div>
</div></div>