<font color="#000000"><font size="2"><font face="trebuchet ms,sans-serif">i'm playing with the drag control and i would like to display the feature position while dragging<br><br>onDrag: function(feature, pixel){<br><br>
var pos = feature.geometry.getBounds().getCenterLonLat();<br> <br> if(!feature.coordPopup){<br> var coordPopup = new OpenLayers.Popup.Anchored("coords",pos,null,"", {<br>
offset: new OpenLayers.Pixel(0,20),<br> size: new OpenLayers.Size(0,0) <br> });<br> coordPopup.calculateRelativePosition = function(){return "tr";}<br>
<br> feature.coordPopup = coordPopup;<br> map.addPopup(feature.coordPopup);<br> };<br><br><br> pos = map.getViewPortPxFromLonLat(pos);<br>
feature.coordPopup.setContentHTML(pos);<br> feature.coordPopup.updateSize();<br> <br><br> feature.coordPopup.moveTo(pos);<br>
},<br> upFeature: function(pixel){<br> map.removePopup(this.feature.coordPopup);<br> this.feature.coordPopup.destroy();<br> this.feature.coordPopup = null;<br>
}<br><br></font></font></font><font color="#000000"><font size="2"><font face="trebuchet ms,sans-serif">everything is ok <br>popup moves as the feature is dragged and shows the current position<br>BUT when i pan the map the popup is drawn at different position even if the viewportpx is the same<br>
<br>for example<br>before pan: popup at 100,100<br>after pan: same position (popup display 100,100) but popup is drawn at 150,70<br><br>what i'm doing wrong??<br><br><br>Vito<br><br><br><br><br><br clear="all"></font></font></font>--<br>
-----------<br>Tafuni Vito<br><a href="mailto:vito@vitotafuni.com">vito@vitotafuni.com</a><br>---------------------------------------------<br>"Verba volant, scripta manent... data corrupted"<br>