i'm trying to implement the example http://openlayers.org/dev/examples/drag-feature.html .
When i'm implementing this with a Google map, I have a strange bug: the mouse pointer and the dot on the map are not in the same place.
Now if I change the line that in bold: map.addLayers([gmap,vectors]); to map.addLayers([wms,vectors]); everything works. (in other words I dont use google maps).
Can someone tell me what is happening?
Thanks in advance.
Here is my page and code:
var map;
var vectors;
function initialize() {
// Create the map object
map = new OpenLayers.Map('map');
//Create a Google layer
var gmap = new OpenLayers.Layer.Google(
"Google Streets", // the default
{numZoomLevels: 20}
);
// if i use this instead of gmap then everything works.
var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://vmap0.tiles.osgeo.org/wms/vmap0?", {layers: 'basic'});
var renderer=OpenLayers.Util.getParameters(window.location.href).renderer;
renderer=(renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;
vectors= new OpenLayers.Layer.Vector("Vector Layer",{
renderers:renderer
});
map.addLayers([gmap,vectors]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.MousePosition());
var control=new OpenLayers.Control.DrawFeature(vectors,OpenLayers.Handler.Path);
map.addControl(control);
control.activate();
// Zoom to Vancouver, BC
map.setCenter(new OpenLayers.LonLat(-123.12, 49.28), 13);
}
I´m not really sure what you mean. All works fine for me. See my example with your code.