I'm trying to display mouse position on external div (ExtJS based) using this code :
map.events.register("mousemove", map, function(e) { position = map.getLonLatFromLayerPx(this.events.getMousePosition(e)); position = position.transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326")); Ext.fly(mouseposition.getEl()).update("Lat (N): " + position.lat.toFixed(4) + " Long (E): " + position.lon.toFixed(4) ); });The problem is that when I pan the map than the coords I get are the original from before the pan , only if I zoom in/out than I get the correct coords from the mouse position.
How can I fix this ?
أكثر...
map.events.register("mousemove", map, function(e) { position = map.getLonLatFromLayerPx(this.events.getMousePosition(e)); position = position.transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326")); Ext.fly(mouseposition.getEl()).update("Lat (N): " + position.lat.toFixed(4) + " Long (E): " + position.lon.toFixed(4) ); });The problem is that when I pan the map than the coords I get are the original from before the pan , only if I zoom in/out than I get the correct coords from the mouse position.
How can I fix this ?
أكثر...