There is no reason to restrict graphicTitle to externalGraphic symbols.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user