[OpenLayers-Commits] r11584 -
trunk/openlayers/lib/OpenLayers/Renderer
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Mon Feb 28 13:56:04 EST 2011
Author: ahocevar
Date: 2011-02-28 10:56:00 -0800 (Mon, 28 Feb 2011)
New Revision: 11584
Modified:
trunk/openlayers/lib/OpenLayers/Renderer/SVG.js
Log:
modifier+click no longer opens a new tab on FF when using externalGraphic. r=bartvde,pgiraud (closes #1421)
Modified: trunk/openlayers/lib/OpenLayers/Renderer/SVG.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Renderer/SVG.js 2011-02-28 17:11:08 UTC (rev 11583)
+++ trunk/openlayers/lib/OpenLayers/Renderer/SVG.js 2011-02-28 18:56:00 UTC (rev 11584)
@@ -285,6 +285,7 @@
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 @@
"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();
+};
More information about the Commits
mailing list