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

Conversation

@fritz-c
Copy link
Contributor

@fritz-c fritz-c commented Jun 2, 2016

When markers are occupying a large portion of the clickable area of the map, it can be frustrating to try to pan about the map and accidentally trigger unwanted click events.

The default behavior for Google Maps markers, presumably in response to this issue, appears to be as follows:
When a drag event occurs between the mousedown and mouseup of a click, the click event is not called.

Here's with the InfoWindow sample code for example:
marker-behavior

js-marker-clusterer, before

However, js-marker-clusterer, by changing the markers to an overlay, loses this behavior:
cluster-behavior-before

js-marker-clusterer, after

This pull request restores the behavior of the markers, as in:
cluster-behavior-after

@broady
Copy link
Contributor

broady commented Jun 2, 2016

LGTM. Have you signed the CLA?

@fritz-c
Copy link
Contributor Author

fritz-c commented Jun 2, 2016

Yes, I have. The email (gmail) is a secondary email on this account, however. Would that be an issue?

@broady
Copy link
Contributor

broady commented Jun 2, 2016

Nope, that's OK.

@broady broady merged commit 6b9afb1 into googlearchive:gh-pages Jun 2, 2016
@fritz-c fritz-c deleted the patch-2 branch June 2, 2016 01:02
Sphinxxxx added a commit to Sphinxxxx/js-marker-clusterer that referenced this pull request Jul 13, 2016
Related to pull request googlearchive#78

Because of an old bug (https://bugs.chromium.org/p/chromium/issues/detail?id=161464), Chrome raises a `mousemove` event with every `mousedown`. Therefore, we need to see if the mouse moves a little before we set the `isDragging` flag.
@Sphinxxxx Sphinxxxx mentioned this pull request Jul 13, 2016
@cwellsx
Copy link

cwellsx commented Apr 18, 2017

This breaks (i.e. it disables) zoomOnClick functionality on Chrome, possibly due to a Chrome bug which inserts a mousemove after mousedown before click -- https://bugs.chromium.org/p/chromium/issues/detail?id=161464

I'm currently using Chrome version 57.0.2987.133 on Windows 10 version 1607 (64-bit).

IMO you can fix this by changing the new mousemove handler to ...

google.maps.event.addDomListener(this.div_, 'mousemove', function(event) {
    if (event.movementX || event.movementY) {
        isDragging = true;
    }
});

... so that it doesn't set isDragging if the movementX and movementY of the mousemove event are both zero.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants