reverting r11645, and fixing the root of the reported problem. r=bartvde (closes #2392)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11697 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -510,12 +510,6 @@ OpenLayers.Map = OpenLayers.Class({
|
|||||||
this.div = document.createElement("div");
|
this.div = document.createElement("div");
|
||||||
this.div.style.height = "1px";
|
this.div.style.height = "1px";
|
||||||
this.div.style.width = "1px";
|
this.div.style.width = "1px";
|
||||||
|
|
||||||
// Adding this to the DOM is a fix for Safari SVG rendering bugs;
|
|
||||||
// See #2392. On initial render(), it is removed from the dom,
|
|
||||||
// and a new div is added.
|
|
||||||
this.div.style.display = "none";
|
|
||||||
document.body.appendChild(this.div);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenLayers.Element.addClass(this.div, 'olMap');
|
OpenLayers.Element.addClass(this.div, 'olMap');
|
||||||
@@ -650,11 +644,6 @@ OpenLayers.Map = OpenLayers.Class({
|
|||||||
* will be moved from the current to the new container.
|
* will be moved from the current to the new container.
|
||||||
*/
|
*/
|
||||||
render: function(div) {
|
render: function(div) {
|
||||||
// Fix for Safari SVG rendering bugs; See #2392
|
|
||||||
if(this.div && this.div.parentNode) {
|
|
||||||
this.div.parentNode.removeChild(this.div);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.div = OpenLayers.Util.getElement(div);
|
this.div = OpenLayers.Util.getElement(div);
|
||||||
OpenLayers.Element.addClass(this.div, 'olMap');
|
OpenLayers.Element.addClass(this.div, 'olMap');
|
||||||
this.viewPortDiv.parentNode.removeChild(this.viewPortDiv);
|
this.viewPortDiv.parentNode.removeChild(this.viewPortDiv);
|
||||||
|
|||||||
@@ -290,9 +290,9 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
// the symbol viewBox is three times as large as the symbol
|
// the symbol viewBox is three times as large as the symbol
|
||||||
var offset = style.pointRadius * 3;
|
var offset = style.pointRadius * 3;
|
||||||
var size = offset * 2;
|
var size = offset * 2;
|
||||||
var id = this.importSymbol(style.graphicName);
|
var src = this.importSymbol(style.graphicName);
|
||||||
pos = this.getPosition(node);
|
pos = this.getPosition(node);
|
||||||
widthFactor = this.symbolMetrics[id][0] * 3 / size;
|
widthFactor = this.symbolMetrics[src.id][0] * 3 / size;
|
||||||
|
|
||||||
// remove the node from the dom before we modify it. This
|
// remove the node from the dom before we modify it. This
|
||||||
// prevents various rendering issues in Safari and FF
|
// prevents various rendering issues in Safari and FF
|
||||||
@@ -308,7 +308,6 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
// See e.g. ticket http://trac.osgeo.org/openlayers/ticket/2985
|
// See e.g. ticket http://trac.osgeo.org/openlayers/ticket/2985
|
||||||
// and this email thread
|
// and this email thread
|
||||||
// http://osgeo-org.1803224.n2.nabble.com/Select-Control-Ctrl-click-on-Feature-with-a-graphicName-opens-new-browser-window-tc5846039.html
|
// http://osgeo-org.1803224.n2.nabble.com/Select-Control-Ctrl-click-on-Feature-with-a-graphicName-opens-new-browser-window-tc5846039.html
|
||||||
var src = document.getElementById(id);
|
|
||||||
node.firstChild && node.removeChild(node.firstChild);
|
node.firstChild && node.removeChild(node.firstChild);
|
||||||
node.appendChild(src.firstChild.cloneNode(true));
|
node.appendChild(src.firstChild.cloneNode(true));
|
||||||
node.setAttributeNS(null, "viewBox", src.getAttributeNS(null, "viewBox"));
|
node.setAttributeNS(null, "viewBox", src.getAttributeNS(null, "viewBox"));
|
||||||
@@ -339,7 +338,7 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
"rotate(" + rotation + " " + pos.x + " " +
|
"rotate(" + rotation + " " + pos.x + " " +
|
||||||
pos.y + ")");
|
pos.y + ")");
|
||||||
} else {
|
} else {
|
||||||
var metrics = this.symbolMetrics[id];
|
var metrics = this.symbolMetrics[src.id];
|
||||||
node.firstChild.setAttributeNS(null, "transform", "rotate("
|
node.firstChild.setAttributeNS(null, "transform", "rotate("
|
||||||
+ rotation + " "
|
+ rotation + " "
|
||||||
+ metrics[1] + " "
|
+ metrics[1] + " "
|
||||||
@@ -881,7 +880,7 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
* graphicName - {String} name of the symbol to import
|
* graphicName - {String} name of the symbol to import
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {String} - id of the imported symbol
|
* {DOMElement} - the imported symbol
|
||||||
*/
|
*/
|
||||||
importSymbol: function (graphicName) {
|
importSymbol: function (graphicName) {
|
||||||
if (!this.defs) {
|
if (!this.defs) {
|
||||||
@@ -891,8 +890,9 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
var id = this.container.id + "-" + graphicName;
|
var id = this.container.id + "-" + graphicName;
|
||||||
|
|
||||||
// check if symbol already exists in the defs
|
// check if symbol already exists in the defs
|
||||||
if (document.getElementById(id) != null) {
|
var existing = document.getElementById(id)
|
||||||
return id;
|
if (existing != null) {
|
||||||
|
return existing;
|
||||||
}
|
}
|
||||||
|
|
||||||
var symbol = OpenLayers.Renderer.symbol[graphicName];
|
var symbol = OpenLayers.Renderer.symbol[graphicName];
|
||||||
@@ -934,7 +934,7 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
];
|
];
|
||||||
|
|
||||||
this.defs.appendChild(symbolNode);
|
this.defs.appendChild(symbolNode);
|
||||||
return symbolNode.id;
|
return symbolNode;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -217,8 +217,8 @@ OpenLayers.Renderer.SVG2 = OpenLayers.Class(OpenLayers.Renderer.NG, {
|
|||||||
// the symbol viewBox is three times as large as the symbol
|
// the symbol viewBox is three times as large as the symbol
|
||||||
var offset = style.pointRadius * 3 * resolution;
|
var offset = style.pointRadius * 3 * resolution;
|
||||||
var size = offset * 2;
|
var size = offset * 2;
|
||||||
var id = this.importSymbol(style.graphicName);
|
var src = this.importSymbol(style.graphicName);
|
||||||
widthFactor = this.symbolMetrics[id].size * 3 / size * resolution;
|
widthFactor = this.symbolMetrics[src.id].size * 3 / size * resolution;
|
||||||
|
|
||||||
// remove the node from the dom before we modify it. This
|
// remove the node from the dom before we modify it. This
|
||||||
// prevents various rendering issues in Safari and FF
|
// prevents various rendering issues in Safari and FF
|
||||||
@@ -234,7 +234,6 @@ OpenLayers.Renderer.SVG2 = OpenLayers.Class(OpenLayers.Renderer.NG, {
|
|||||||
// See e.g. ticket http://trac.osgeo.org/openlayers/ticket/2985
|
// See e.g. ticket http://trac.osgeo.org/openlayers/ticket/2985
|
||||||
// and this email thread
|
// and this email thread
|
||||||
// http://osgeo-org.1803224.n2.nabble.com/Select-Control-Ctrl-click-on-Feature-with-a-graphicName-opens-new-browser-window-tc5846039.html
|
// http://osgeo-org.1803224.n2.nabble.com/Select-Control-Ctrl-click-on-Feature-with-a-graphicName-opens-new-browser-window-tc5846039.html
|
||||||
var src = document.getElementById(id);
|
|
||||||
node.firstChild && node.removeChild(node.firstChild);
|
node.firstChild && node.removeChild(node.firstChild);
|
||||||
node.appendChild(src.firstChild.cloneNode(true));
|
node.appendChild(src.firstChild.cloneNode(true));
|
||||||
node.setAttributeNS(null, "viewBox", src.getAttributeNS(null, "viewBox"));
|
node.setAttributeNS(null, "viewBox", src.getAttributeNS(null, "viewBox"));
|
||||||
@@ -264,7 +263,7 @@ OpenLayers.Renderer.SVG2 = OpenLayers.Class(OpenLayers.Renderer.NG, {
|
|||||||
["rotate(", rotation, node._x, node._y, ")"].join(" ")
|
["rotate(", rotation, node._x, node._y, ")"].join(" ")
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
var metrics = this.symbolMetrics[id];
|
var metrics = this.symbolMetrics[src.id];
|
||||||
node.firstChild.setAttributeNS(null, "transform",
|
node.firstChild.setAttributeNS(null, "transform",
|
||||||
["rotate(", rotation, metrics.x, metrics.y, ")"].join(" ")
|
["rotate(", rotation, metrics.x, metrics.y, ")"].join(" ")
|
||||||
);
|
);
|
||||||
@@ -679,7 +678,7 @@ OpenLayers.Renderer.SVG2 = OpenLayers.Class(OpenLayers.Renderer.NG, {
|
|||||||
* graphicName - {String} name of the symbol to import
|
* graphicName - {String} name of the symbol to import
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {String} - id of the imported symbol
|
* {DOMElement} - the imported symbol
|
||||||
*/
|
*/
|
||||||
importSymbol: function (graphicName) {
|
importSymbol: function (graphicName) {
|
||||||
if (!this.defs) {
|
if (!this.defs) {
|
||||||
@@ -689,8 +688,9 @@ OpenLayers.Renderer.SVG2 = OpenLayers.Class(OpenLayers.Renderer.NG, {
|
|||||||
var id = this.container.id + "-" + graphicName;
|
var id = this.container.id + "-" + graphicName;
|
||||||
|
|
||||||
// check if symbol already exists in the defs
|
// check if symbol already exists in the defs
|
||||||
if (document.getElementById(id) != null) {
|
var existing = document.getElementById(id);
|
||||||
return id;
|
if (existing != null) {
|
||||||
|
return existing;
|
||||||
}
|
}
|
||||||
|
|
||||||
var symbol = OpenLayers.Renderer.symbol[graphicName];
|
var symbol = OpenLayers.Renderer.symbol[graphicName];
|
||||||
@@ -732,7 +732,7 @@ OpenLayers.Renderer.SVG2 = OpenLayers.Class(OpenLayers.Renderer.NG, {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.defs.appendChild(symbolNode);
|
this.defs.appendChild(symbolNode);
|
||||||
return symbolNode.id;
|
return symbolNode;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user