Better fix for SVG rendering issues when redrawing complex graphics. Thanks tschaub for the investigation and the original patch which pointed me into the right direction. r=tschaub (pullup #2101)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@9405 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -291,23 +291,28 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
||||
var href = "#" + id;
|
||||
pos = this.getPosition(node);
|
||||
widthFactor = this.symbolSize[id] / size;
|
||||
// Only set the href if it is different from the current one.
|
||||
// This is a workaround for strange rendering behavior in FF3.
|
||||
if (node.getAttributeNS(this.xlinkns, "href") != href) {
|
||||
node.setAttributeNS(this.xlinkns, "href", href);
|
||||
} else if (size != parseFloat(node.getAttributeNS(null, "width"))) {
|
||||
// hide the element (and force a reflow so it really gets
|
||||
// hidden. This workaround is needed for Safari.
|
||||
node.style.visibility = "hidden";
|
||||
this.container.scrollLeft = this.container.scrollLeft;
|
||||
|
||||
// remove the node from the dom before we modify it. This
|
||||
// prevents various rendering issues in Safari and FF
|
||||
var parent = node.parentNode;
|
||||
var nextSibling = node.nextSibling;
|
||||
if(parent) {
|
||||
parent.removeChild(node);
|
||||
}
|
||||
|
||||
node.setAttributeNS(this.xlinkns, "href", href);
|
||||
node.setAttributeNS(null, "width", size);
|
||||
node.setAttributeNS(null, "height", size);
|
||||
node.setAttributeNS(null, "x", pos.x - offset);
|
||||
node.setAttributeNS(null, "y", pos.y - offset);
|
||||
// set the visibility back to normal (after the Safari
|
||||
// workaround above)
|
||||
node.style.visibility = "";
|
||||
|
||||
// now that the node has all its new properties, insert it
|
||||
// back into the dom where it was
|
||||
if(nextSibling) {
|
||||
parent.insertBefore(node, nextSibling);
|
||||
} else if(parent) {
|
||||
parent.appendChild(node);
|
||||
}
|
||||
} else {
|
||||
node.setAttributeNS(null, "r", style.pointRadius);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user