Skip to content
This repository was archived by the owner on Jun 16, 2019. It is now read-only.

Commit 16a2e86

Browse files
committed
Only perform click event when not preceded by a drag
1 parent c259d33 commit 16a2e86

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@
1212
Luke Mahé <[email protected]>
1313
Brendan Kenny <[email protected]>
1414
Moisés Arcos <[email protected]>
15+
Chris Fritz <[email protected]>

src/markerclusterer.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1072,8 +1072,18 @@ ClusterIcon.prototype.onAdd = function() {
10721072
panes.overlayMouseTarget.appendChild(this.div_);
10731073

10741074
var that = this;
1075+
var isDragging = false;
10751076
google.maps.event.addDomListener(this.div_, 'click', function(event) {
1076-
that.triggerClusterClick(event);
1077+
// Only perform click when not preceded by a drag
1078+
if (!isDragging) {
1079+
that.triggerClusterClick(event);
1080+
}
1081+
});
1082+
google.maps.event.addDomListener(this.div_, 'mousedown', function() {
1083+
isDragging = false;
1084+
});
1085+
google.maps.event.addDomListener(this.div_, 'mousemove', function() {
1086+
isDragging = true;
10771087
});
10781088
};
10791089

0 commit comments

Comments
 (0)