anyone interested in the solution of this problem: moveTo use layerPx info instead of ViewPortPx so
pos = map.getLayerPxFromViewPortPx(map.getViewPortPxFromLonLat(pos)); solved the problem! -Vito- -- ----------- Tafuni Vito v...@vitotafuni.com --------------------------------------------- "Verba volant, scripta manent... data corrupted" 2010/6/21 Vito Tafuni <vitotaf...@gmail.com> > 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 > v...@vitotafuni.com > --------------------------------------------- > "Verba volant, scripta manent... data corrupted" >
_______________________________________________ Dev mailing list Dev@openlayers.org http://openlayers.org/mailman/listinfo/dev