Hi All,<br><br>I'm getting some strange behavior with the select and highlight feature select controls. This maybe sloppy, but yesterday this "worked" fine, (i.e. the sites highlighted when moused-over and popups appeared). Today, the sites highlight to a light blue, and sometimes stay highlighted, and no popups appear. Not sure what's going on. <br>
<br>here's my code. I'm using the url to the api rather than a local file.<br><br>var map, controls, selectControl, selectedFeature;<br>function init() {<br> map = new OpenLayers.Map ("map", <br>
{<br> controls:[<br> new OpenLayers.Control.Navigation(),<br> new OpenLayers.Control.PanZoomBar(),<br> new OpenLayers.Control.LayerSwitcher(),<br>
new OpenLayers.Control.Attribution()],<br> sphericalMercator: true,<br> maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),<br> maxResolution: 156543.0399,<br>
numZoomLevels: 19,<br> units: 'm',<br> projection: new OpenLayers.Projection("EPSG:900913"),<br> displayProjection: new OpenLayers.Projection("EPSG:4326"),<br>
}<br> );<br> var myBaseLayer = new OpenLayers.Layer.WMS( "OpenLayers WMS",<br> "<a href="http://labs.metacarta.com/wms/vmap0">http://labs.metacarta.com/wms/vmap0</a>", {layers: 'basic', projection: "myproj"} ); <br>
map.addLayer(myBaseLayer); <br> <br> var topo = new OpenLayers.Layer.GML("Topography", "data/test4.gml", {<br> projection: new OpenLayers.Projection("EPSG:4326")}); <br>
map.addLayer(topo);<br> <br><br>// Selection and hoverstate controls<br> var report = function(e) {<br> OpenLayers.Console.log(e.type, <a href="http://e.feature.id">e.feature.id</a>);<br>
};<br> <br> var highlightCtrl = new OpenLayers.Control.SelectFeature(topo, {<br> hover: true,<br> highlightOnly: true,<br> renderIntent: "temporary",<br>
eventListeners: {<br> beforefeaturehighlighted: report,<br> featurehighlighted: report,<br> featureunhighlighted: report<br> }<br> });<br>
<br> var selectCtrl = new OpenLayers.Control.SelectFeature(topo,<br> {clickout: true}<br> );<br><br> map.addControl(highlightCtrl);<br> map.addControl(selectCtrl);<br><br>
highlightCtrl.activate();<br> selectCtrl.activate();<br>//Popups and <br> function onPopupClose(evt) {<br> selectControl.unselect(selectedFeature);<br> }<br> function onFeatureSelect(feature) {<br>
selectedFeature = feature;<br> popup = new OpenLayers.Popup.FramedCloud("chicken", <br> feature.geometry.getBounds().getCenterLonLat(),<br> null,<br>
"<div style='font-size:.8em'>Feature: " + feature.attributes.title +"<br />Area: " + feature.attributes.newsite_+"<br/>This should do something<br/> This should do something else</div>",<br>
null, true, onPopupClose);<br> feature.popup = popup;<br> map.addPopup(popup);<br> }<br> function onFeatureUnselect(feature) {<br> map.removePopup(feature.popup);<br>
feature.popup.destroy();<br> feature.popup = null;<br> } <br><br> if( ! map.getCenter() ){<br> topo.events.register('loadend', topo, function(){map.zoomToExtent(topo.getDataExtent())});<br>
map.setCenter(null, null);<br> };<br> }<br><input id="gwProxy" type="hidden"><input onclick="jsCall();" id="jsProxy" type="hidden"><div id="refHTML"></div>