I have createc a select control and a StyleMap that includes default marker and select marker.
var mystyle = new OpenLayers.StyleMap({ "default": new OpenLayers.Style("null", { "rules": [ new OpenLayers.Rule({ "symbolizer": { "Point": { externalGraphic: "images/marker-red-24.png", graphicWidth: 24, graphicHeight: 20, cursor: "pointer" } } }) ] }), "select": new OpenLayers.Style("null", { "rules": [ new OpenLayers.Rule({ "symbolizer": { "Point": { externalGraphic: "images/hand.png", graphicWidth: 24, graphicHeight: 20, cursor: "pointer" } } }) ] }), "temporary": new OpenLayers.Style("null", { "rules": [ new OpenLayers.Rule({ "symbolizer": { "Point": { externalGraphic: "images/hand.png", graphicWidth: 24, graphicHeight: 20, cursor: "pointer" } } }) ] }), }); my select control is like this,
var myControl = new OpenLayers.Control.SelectFeature(layer, { clickout: false, toggle: true, multiple: false, hover: false, toggleKey: "shiftKey", // ctrl key removes from selection multipleKey: "ctrlKey", // shift key adds to selection, highlightOnly: true, renderIntent: "temporary", }); I am selecting the feature on the map. Selected feature icon is changing successful. But when I zoom map the selected icon is changing to default icon.
أكثر...
var mystyle = new OpenLayers.StyleMap({ "default": new OpenLayers.Style("null", { "rules": [ new OpenLayers.Rule({ "symbolizer": { "Point": { externalGraphic: "images/marker-red-24.png", graphicWidth: 24, graphicHeight: 20, cursor: "pointer" } } }) ] }), "select": new OpenLayers.Style("null", { "rules": [ new OpenLayers.Rule({ "symbolizer": { "Point": { externalGraphic: "images/hand.png", graphicWidth: 24, graphicHeight: 20, cursor: "pointer" } } }) ] }), "temporary": new OpenLayers.Style("null", { "rules": [ new OpenLayers.Rule({ "symbolizer": { "Point": { externalGraphic: "images/hand.png", graphicWidth: 24, graphicHeight: 20, cursor: "pointer" } } }) ] }), }); my select control is like this,
var myControl = new OpenLayers.Control.SelectFeature(layer, { clickout: false, toggle: true, multiple: false, hover: false, toggleKey: "shiftKey", // ctrl key removes from selection multipleKey: "ctrlKey", // shift key adds to selection, highlightOnly: true, renderIntent: "temporary", }); I am selecting the feature on the map. Selected feature icon is changing successful. But when I zoom map the selected icon is changing to default icon.
أكثر...