diff --git a/lib/OpenLayers/Control/MouseDefaults.js b/lib/OpenLayers/Control/MouseDefaults.js index 861c02c7ba..c0d4378d44 100644 --- a/lib/OpenLayers/Control/MouseDefaults.js +++ b/lib/OpenLayers/Control/MouseDefaults.js @@ -3,18 +3,27 @@ OpenLayers.Control.MouseDefaults = Class.create(); OpenLayers.Control.MouseDefaults.prototype = Object.extend( new OpenLayers.Control(), { + performedDrag: false, + initialize: function() { OpenLayers.Control.prototype.initialize.apply(this, arguments); }, draw: function() { + this.map.events.register( "click", this, this.defaultClick ); this.map.events.register( "dblclick", this, this.defaultDblClick ); this.map.events.register( "mousedown", this, this.defaultMouseDown ); this.map.events.register( "mouseup", this, this.defaultMouseUp ); this.map.events.register( "mousemove", this, this.defaultMouseMove ); this.map.events.register( "mouseout", this, this.defaultMouseOut ); }, - + + defaultClick: function (evt) { + var notAfterDrag = !this.performedDrag; + this.performedDrag = false; + return notAfterDrag; + }, + /** * @param {Event} evt */ @@ -28,6 +37,7 @@ OpenLayers.Control.MouseDefaults.prototype = */ defaultMouseDown: function (evt) { this.mouseDragStart = evt.xy.copyOf(); + this.performedDrag = false; if (evt.shiftKey) { this.map.div.style.cursor = "crosshair"; this.zoomBox = OpenLayers.Util.createDiv('zoomBox', @@ -41,8 +51,6 @@ OpenLayers.Control.MouseDefaults.prototype = this.zoomBox.style.opacity = "0.50"; this.zoomBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1; this.map.viewPortDiv.appendChild(this.zoomBox); - } else { - this.map.div.style.cursor = "move"; } Event.stop(evt); }, @@ -72,7 +80,9 @@ OpenLayers.Control.MouseDefaults.prototype = var newCenter = this.map.getLonLatFromScreenPx( newXY ); this.map.setCenter(newCenter, null, true); this.mouseDragStart = evt.xy.copyOf(); + this.map.div.style.cursor = "move"; } + this.performedDrag = true; } },