diff --git a/lib/OpenLayers/Feature/Vector.js b/lib/OpenLayers/Feature/Vector.js index 6f36fec67c..c4ebdf6638 100644 --- a/lib/OpenLayers/Feature/Vector.js +++ b/lib/OpenLayers/Feature/Vector.js @@ -403,7 +403,7 @@ OpenLayers.Feature.Vector = OpenLayers.Class(OpenLayers.Feature, { * graphicZIndex - {Number} The integer z-index value to use in rendering. * graphicName - {String} Named graphic to use when rendering points. Supported values include "circle" (default), * "square", "star", "x", "cross", "triangle". - * graphicTitle - {String} Tooltip for an external graphic. + * graphicTitle - {String} Tooltip when hovering over a feature. Not supported by the canvas renderer. * backgroundGraphic - {String} Url to a graphic to be used as the background under an externalGraphic. * backgroundGraphicZIndex - {Number} The integer z-index value to use in rendering the background graphic. * backgroundXOffset - {Number} The x offset (in pixels) for the background graphic. diff --git a/lib/OpenLayers/Renderer/SVG.js b/lib/OpenLayers/Renderer/SVG.js index e65da76a9a..a43434f6b7 100644 --- a/lib/OpenLayers/Renderer/SVG.js +++ b/lib/OpenLayers/Renderer/SVG.js @@ -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"); } diff --git a/lib/OpenLayers/Renderer/VML.js b/lib/OpenLayers/Renderer/VML.js index 50c3d682a9..ba724ea76e 100644 --- a/lib/OpenLayers/Renderer/VML.js +++ b/lib/OpenLayers/Renderer/VML.js @@ -207,12 +207,13 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, { options = options || node._options; var fillColor = style.fillColor; + if (style.graphicTitle) { + node.title=style.graphicTitle; + } + if (node._geometryClass === "OpenLayers.Geometry.Point") { if (style.externalGraphic) { options.isFilled = true; - if (style.graphicTitle) { - node.title=style.graphicTitle; - } var width = style.graphicWidth || style.graphicHeight; var height = style.graphicHeight || style.graphicWidth; width = width ? width : style.pointRadius*2;