There is no reason to restrict graphicTitle to externalGraphic symbols.

This commit is contained in:
ahocevar
2012-05-05 12:49:25 +02:00
parent b61cfdb054
commit d01f57d3e6
3 changed files with 20 additions and 18 deletions
+1 -1
View File
@@ -403,7 +403,7 @@ OpenLayers.Feature.Vector = OpenLayers.Class(OpenLayers.Feature, {
* graphicZIndex - {Number} The integer z-index value to use in rendering. * 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), * graphicName - {String} Named graphic to use when rendering points. Supported values include "circle" (default),
* "square", "star", "x", "cross", "triangle". * "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. * 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. * 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. * backgroundXOffset - {Number} The x offset (in pixels) for the background graphic.
+10 -9
View File
@@ -239,15 +239,6 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
setStyle: function(node, style, options) { setStyle: function(node, style, options) {
style = style || node._style; style = style || node._style;
options = options || node._options; options = options || node._options;
var r = parseFloat(node.getAttributeNS(null, "r"));
var widthFactor = 1;
var pos;
if (node._geometryClass == "OpenLayers.Geometry.Point" && r) {
node.style.visibility = "";
if (style.graphic === false) {
node.style.visibility = "hidden";
} else if (style.externalGraphic) {
pos = this.getPosition(node);
if (style.graphicTitle) { if (style.graphicTitle) {
node.setAttributeNS(null, "title", style.graphicTitle); node.setAttributeNS(null, "title", style.graphicTitle);
@@ -262,6 +253,16 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
node.appendChild(label); node.appendChild(label);
} }
} }
var r = parseFloat(node.getAttributeNS(null, "r"));
var widthFactor = 1;
var pos;
if (node._geometryClass == "OpenLayers.Geometry.Point" && r) {
node.style.visibility = "";
if (style.graphic === false) {
node.style.visibility = "hidden";
} else if (style.externalGraphic) {
pos = this.getPosition(node);
if (style.graphicWidth && style.graphicHeight) { if (style.graphicWidth && style.graphicHeight) {
node.setAttributeNS(null, "preserveAspectRatio", "none"); node.setAttributeNS(null, "preserveAspectRatio", "none");
} }
+4 -3
View File
@@ -207,12 +207,13 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
options = options || node._options; options = options || node._options;
var fillColor = style.fillColor; var fillColor = style.fillColor;
if (node._geometryClass === "OpenLayers.Geometry.Point") {
if (style.externalGraphic) {
options.isFilled = true;
if (style.graphicTitle) { if (style.graphicTitle) {
node.title=style.graphicTitle; node.title=style.graphicTitle;
} }
if (node._geometryClass === "OpenLayers.Geometry.Point") {
if (style.externalGraphic) {
options.isFilled = true;
var width = style.graphicWidth || style.graphicHeight; var width = style.graphicWidth || style.graphicHeight;
var height = style.graphicHeight || style.graphicWidth; var height = style.graphicHeight || style.graphicWidth;
width = width ? width : style.pointRadius*2; width = width ? width : style.pointRadius*2;