There is no reason to restrict graphicTitle to externalGraphic symbols.
This commit is contained in:
@@ -239,6 +239,21 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
||||
setStyle: function(node, style, options) {
|
||||
style = style || node._style;
|
||||
options = options || node._options;
|
||||
|
||||
if (style.graphicTitle) {
|
||||
node.setAttributeNS(null, "title", style.graphicTitle);
|
||||
//Standards-conformant SVG
|
||||
// Prevent duplicate nodes. See issue https://github.com/openlayers/openlayers/issues/92
|
||||
var titleNode = node.getElementsByTagName("title");
|
||||
if (titleNode.length > 0) {
|
||||
titleNode[0].firstChild.textContent = style.graphicTitle;
|
||||
} else {
|
||||
var label = this.nodeFactory(null, "title");
|
||||
label.textContent = style.graphicTitle;
|
||||
node.appendChild(label);
|
||||
}
|
||||
}
|
||||
|
||||
var r = parseFloat(node.getAttributeNS(null, "r"));
|
||||
var widthFactor = 1;
|
||||
var pos;
|
||||
@@ -248,20 +263,6 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
||||
node.style.visibility = "hidden";
|
||||
} else if (style.externalGraphic) {
|
||||
pos = this.getPosition(node);
|
||||
|
||||
if (style.graphicTitle) {
|
||||
node.setAttributeNS(null, "title", style.graphicTitle);
|
||||
//Standards-conformant SVG
|
||||
// Prevent duplicate nodes. See issue https://github.com/openlayers/openlayers/issues/92
|
||||
var titleNode = node.getElementsByTagName("title");
|
||||
if (titleNode.length > 0) {
|
||||
titleNode[0].firstChild.textContent = style.graphicTitle;
|
||||
} else {
|
||||
var label = this.nodeFactory(null, "title");
|
||||
label.textContent = style.graphicTitle;
|
||||
node.appendChild(label);
|
||||
}
|
||||
}
|
||||
if (style.graphicWidth && style.graphicHeight) {
|
||||
node.setAttributeNS(null, "preserveAspectRatio", "none");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user