Change position to absolute, and round pixel values. This puts markers back in their place.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@196 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -51,8 +51,8 @@ OpenLayers.Layer.Marker.prototype =
|
|||||||
var resolution = this.map.getResolution();
|
var resolution = this.map.getResolution();
|
||||||
var extent = this.map.getExtent();
|
var extent = this.map.getExtent();
|
||||||
var pixel = new OpenLayers.Pixel(
|
var pixel = new OpenLayers.Pixel(
|
||||||
1/resolution * (marker.lonlat.lon - extent.left),
|
Math.round(1/resolution * (marker.lonlat.lon - extent.left)),
|
||||||
1/resolution * (extent.top - marker.lonlat.lat)
|
Math.round(1/resolution * (extent.top - marker.lonlat.lat))
|
||||||
);
|
);
|
||||||
var m = marker.generateMarker(pixel);
|
var m = marker.generateMarker(pixel);
|
||||||
this.div.appendChild(m);
|
this.div.appendChild(m);
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ OpenLayers.Marker.prototype = {
|
|||||||
// by the icon size.
|
// by the icon size.
|
||||||
this.object.style.top = (pixel.y+this.icon.offset.y) + "px"
|
this.object.style.top = (pixel.y+this.icon.offset.y) + "px"
|
||||||
this.object.style.left = (pixel.x+this.icon.offset.x) + "px";
|
this.object.style.left = (pixel.x+this.icon.offset.x) + "px";
|
||||||
|
this.object.style.position = "absolute";
|
||||||
this.object.onclick = this.onclick;
|
this.object.onclick = this.onclick;
|
||||||
return this.object;
|
return this.object;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user