From 8268616ec8bebf8db63c7c8e54ec7c1497dfa72a Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 15 May 2012 12:46:41 +0200 Subject: [PATCH] Rename style.graphicTitle to style.title (the former is now deprecated) --- examples/vector-features.html | 7 ++++--- lib/OpenLayers/Feature/Vector.js | 3 ++- lib/OpenLayers/Renderer/Canvas.js | 5 +++-- lib/OpenLayers/Renderer/SVG.js | 9 +++++---- lib/OpenLayers/Renderer/VML.js | 5 +++-- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/examples/vector-features.html b/examples/vector-features.html index 70fc34a180..62fe8e9816 100644 --- a/examples/vector-features.html +++ b/examples/vector-features.html @@ -49,7 +49,8 @@ strokeWidth: 3, strokeDashstyle: "dashdot", pointRadius: 6, - pointerEvents: "visiblePainted" + pointerEvents: "visiblePainted", + title: "this is a green line" }; /* @@ -70,8 +71,8 @@ style_mark.graphicXOffset = 10; // default is -(style_mark.graphicWidth/2); style_mark.graphicYOffset = -style_mark.graphicHeight; style_mark.externalGraphic = "../img/marker.png"; - // graphicTitle only works in Firefox and Internet Explorer - style_mark.graphicTitle = "this is a test tooltip"; + // title only works in Firefox and Internet Explorer + style_mark.title = "this is a test tooltip"; var vectorLayer = new OpenLayers.Layer.Vector("Simple Geometry", { style: layer_style, diff --git a/lib/OpenLayers/Feature/Vector.js b/lib/OpenLayers/Feature/Vector.js index c4ebdf6638..51fefe70fd 100644 --- a/lib/OpenLayers/Feature/Vector.js +++ b/lib/OpenLayers/Feature/Vector.js @@ -403,7 +403,8 @@ 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 when hovering over a feature. Not supported by the canvas renderer. + * graphicTitle - {String} Tooltip when hovering over a feature. *deprecated*, use title instead + * title - {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/Canvas.js b/lib/OpenLayers/Renderer/Canvas.js index feca10eef0..6453c46709 100644 --- a/lib/OpenLayers/Renderer/Canvas.js +++ b/lib/OpenLayers/Renderer/Canvas.js @@ -241,8 +241,9 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, { drawExternalGraphic: function(geometry, style, featureId) { var img = new Image(); - if (style.graphicTitle) { - img.title = style.graphicTitle; + var title = style.title || style.graphicTitle; + if (title) { + img.title = title; } var width = style.graphicWidth || style.graphicHeight; diff --git a/lib/OpenLayers/Renderer/SVG.js b/lib/OpenLayers/Renderer/SVG.js index a43434f6b7..e7b19f72d1 100644 --- a/lib/OpenLayers/Renderer/SVG.js +++ b/lib/OpenLayers/Renderer/SVG.js @@ -240,16 +240,17 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, { style = style || node._style; options = options || node._options; - if (style.graphicTitle) { - node.setAttributeNS(null, "title", style.graphicTitle); + var title = style.title || style.graphicTitle; + if (title) { + node.setAttributeNS(null, "title", title); //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; + titleNode[0].firstChild.textContent = title; } else { var label = this.nodeFactory(null, "title"); - label.textContent = style.graphicTitle; + label.textContent = title; node.appendChild(label); } } diff --git a/lib/OpenLayers/Renderer/VML.js b/lib/OpenLayers/Renderer/VML.js index ba724ea76e..befb6d10b3 100644 --- a/lib/OpenLayers/Renderer/VML.js +++ b/lib/OpenLayers/Renderer/VML.js @@ -207,8 +207,9 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, { options = options || node._options; var fillColor = style.fillColor; - if (style.graphicTitle) { - node.title=style.graphicTitle; + var title = style.title || style.graphicTitle; + if (title) { + node.title = title; } if (node._geometryClass === "OpenLayers.Geometry.Point") {