modifier+click no longer opens a new tab on FF when using externalGraphic. r=bartvde,pgiraud (closes #1421)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11584 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2011-02-28 18:56:00 +00:00
parent 1f3a64d706
commit 873fa8aa24

View File

@@ -285,6 +285,7 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
node.setAttributeNS(null, "height", height);
node.setAttributeNS(this.xlinkns, "href", style.externalGraphic);
node.setAttributeNS(null, "style", "opacity: "+opacity);
node.onclick = OpenLayers.Renderer.SVG.preventDefault;
} else if (this.isComplexSymbol(style.graphicName)) {
// the symbol viewBox is three times as large as the symbol
var offset = style.pointRadius * 3;
@@ -983,3 +984,12 @@ OpenLayers.Renderer.SVG.LABEL_VSHIFT = {
"t": "-70%",
"b": "0"
};
/**
* Function: OpenLayers.Renderer.SVG.preventDefault
* Used to prevent default events (especially opening images in a new tab on
* ctrl-click) from being executed for externalGraphic symbols
*/
OpenLayers.Renderer.SVG.preventDefault = function(e) {
e.preventDefault && e.preventDefault();
};