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

Fix mobile touch to zoom. Only perform fast click. #121

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/markerclusterer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1075,18 +1075,18 @@ ClusterIcon.prototype.onAdd = function() {
panes.overlayMouseTarget.appendChild(this.div_);

var that = this;
var isDragging = false;
var inClickMs = 0;
google.maps.event.addDomListener(this.div_, 'click', function(event) {
// Only perform click when not preceded by a drag
if (!isDragging) {
// Only perform fast click to zoom
if (inClickMs < 300) {
that.triggerClusterClick(event);
}
});
google.maps.event.addDomListener(this.div_, 'mousedown', function() {
isDragging = false;
inClickMs = Date.now();
});
google.maps.event.addDomListener(this.div_, 'mousemove', function() {
isDragging = true;
google.maps.event.addDomListener(this.div_, 'mouseup', function() {
inClickMs = Date.now() - inClickMs;
});
};

Expand Down