From c6d8bbdf395d2244b16091abc79a5f6a818c55df Mon Sep 17 00:00:00 2001 From: Ogun Date: Wed, 16 Nov 2016 08:47:22 -0800 Subject: [PATCH] Fixing the "clusterclick" firing event generation. --- src/markerclusterer.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/markerclusterer.js b/src/markerclusterer.js index 554fcec..ded9b69 100755 --- a/src/markerclusterer.js +++ b/src/markerclusterer.js @@ -1076,6 +1076,7 @@ ClusterIcon.prototype.onAdd = function() { var that = this; var isDragging = false; + var isMouseDown = false; google.maps.event.addDomListener(this.div_, 'click', function(event) { // Only perform click when not preceded by a drag if (!isDragging) { @@ -1084,9 +1085,16 @@ ClusterIcon.prototype.onAdd = function() { }); google.maps.event.addDomListener(this.div_, 'mousedown', function() { isDragging = false; + isMouseDown = true; + }); + google.maps.event.addDomListener(this.div_, 'mouseup', function() { + isDragging = false; + isMouseDown = false; }); google.maps.event.addDomListener(this.div_, 'mousemove', function() { - isDragging = true; + if (isMouseDown) { + isDragging = true; + } }); };