[OpenLayers-Dev] popup moveto problems
Vito Tafuni
vitotafuni at gmail.com
Mon Jun 21 06:43:37 EDT 2010
i'm playing with the drag control and i would like to display the feature
position while dragging
onDrag: function(feature, pixel){
var pos =
feature.geometry.getBounds().getCenterLonLat();
if(!feature.coordPopup){
var coordPopup = new
OpenLayers.Popup.Anchored("coords",pos,null,"", {
offset: new OpenLayers.Pixel(0,20),
size: new OpenLayers.Size(0,0)
});
coordPopup.calculateRelativePosition =
function(){return "tr";}
feature.coordPopup = coordPopup;
map.addPopup(feature.coordPopup);
};
pos = map.getViewPortPxFromLonLat(pos);
feature.coordPopup.setContentHTML(pos);
feature.coordPopup.updateSize();
feature.coordPopup.moveTo(pos);
},
upFeature: function(pixel){
map.removePopup(this.feature.coordPopup);
this.feature.coordPopup.destroy();
this.feature.coordPopup = null;
}
everything is ok
popup moves as the feature is dragged and shows the current position
BUT when i pan the map the popup is drawn at different position even if the
viewportpx is the same
for example
before pan: popup at 100,100
after pan: same position (popup display 100,100) but popup is drawn at
150,70
what i'm doing wrong??
Vito
--
-----------
Tafuni Vito
vito at vitotafuni.com
---------------------------------------------
"Verba volant, scripta manent... data corrupted"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20100621/fef072db/attachment.html
More information about the Dev
mailing list