[OpenLayers-Trac] Re: [OpenLayers] #3643: Feature drawn in
incorrect position in Google Chrome 18
OpenLayers
trac-20090302 at openlayers.org
Sat May 12 16:48:07 EDT 2012
#3643: Feature drawn in incorrect position in Google Chrome 18
----------------------------+-----------------------------------------------
Reporter: wingmanzz | Owner: crschmidt
Type: bug | Status: new
Priority: minor | Milestone:
Component: Layer.Vector | Version: 2.11
Keywords: vector, chrome | State:
----------------------------+-----------------------------------------------
Comment(by dbussche):
According to my own observation the incorrect positioning of vectors only
occur in: Google Chrome 18 with frame, increasing map div size or
fullscreen browser.
On github.com (link above) two workarounds are proposed: a) give priority
to CANVAS renderer and b) resizing svg root element automatically.
I tried a), but got some issues with OpenLayers/CANVAS in Chrome (for
instance, setOpacity does not work). So I worked out b) in a patch to
OpenLayers:
in Map.js,
inside updateSize: function(),
after if (newSize && !isNaN(newSize.h) && !isNaN(newSize.w)) { ... },
add the following code:
if (OpenLayers.String.contains(navigator.userAgent.toLowerCase(),
"chrome")) {
var mapDiv = this.div;
for (var i = 0; i < this.layers.length; i++) {
var layer = this.layers[i];
if (layer.CLASS_NAME == "OpenLayers.Layer.Vector") {
var size = this.getCurrentSize();
var svgRoot =
document.getElementById(layer.renderer.container.id + "_svgRoot");
svgRoot.style.width = size.w + "px";
svgRoot.style.height = size.h + "px";
}
}
}
OpenLayers.js with this patch can be downloaded from
http://www.fietsrouteplanner.nl/download/OpenLayers.js
--
Ticket URL: <http://trac.openlayers.org/ticket/3643#comment:3>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer
More information about the Trac
mailing list