From 22278a9b5b88778c4ae6578c305a47fca9e189e1 Mon Sep 17 00:00:00 2001 From: cybice Date: Sat, 24 Oct 2015 04:39:36 +0300 Subject: [PATCH] Fix: onClick and Controls click detection --- src/google_map.js | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/src/google_map.js b/src/google_map.js index 691c4df..f299b41 100644 --- a/src/google_map.js +++ b/src/google_map.js @@ -664,10 +664,12 @@ export default class GoogleMap extends Component { if (this.markersDispatcher_) { const currTime = (new Date()).getTime(); if (currTime - this.dragTime_ > K_IDLE_TIMEOUT) { - this._onClick({ - ...this.mouse_, - event, - }); + if (this.mouse_) { + this._onClick({ + ...this.mouse_, + event, + }); + } this.markersDispatcher_.emit('kON_CLICK', event); } @@ -695,28 +697,11 @@ export default class GoogleMap extends Component { } } - _onMapMouseDownCapture = (event) => { + _onMapMouseDownCapture = () => { if (detectBrowser().isChrome) { // to fix strange zoom in chrome - if (event.target !== undefined) { - let res = 0; - let curr = event.target; - while (curr) { - if (curr && curr.getAttribute) { - if (curr.getAttribute('title')) { - res += 10; - } - - if (curr.getAttribute('class') === 'gmnoprint') { - res *= 10; - } - } - curr = curr.parentNode; - } - - if (res === 1000) { - this.zoomControlClickTime_ = (new Date()).getTime(); - } + if (!this.mouse_) { + this.zoomControlClickTime_ = (new Date()).getTime(); } } }