Skip to content

Commit e4801e2

Browse files
committed
Fix: click event occurs even if childMouseUp intercepted.
1 parent adb04c2 commit e4801e2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/google_map.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const kEPS = 0.00001;
4040
const K_GOOGLE_TILE_SIZE = 256;
4141
// real minZoom calculated here _getMinZoom
4242
const K_IDLE_TIMEOUT = 100;
43+
const K_IDLE_CLICK_TIMEOUT = 300;
4344
const DEFAULT_MIN_ZOOM = 3;
4445

4546
function defaultOptions_(/* maps */) {
@@ -681,10 +682,11 @@ export default class GoogleMap extends Component {
681682
}
682683
}
683684

685+
// K_IDLE_CLICK_TIMEOUT - looks like 300 is enough
684686
_onClick = (...args) =>
685687
this.props.onClick &&
686688
!this.childMouseDownArgs_ &&
687-
((new Date()).getTime() - this.childMouseUpTime_) > K_IDLE_TIMEOUT &&
689+
((new Date()).getTime() - this.childMouseUpTime_) > K_IDLE_CLICK_TIMEOUT &&
688690
this.dragTime_ === 0 &&
689691
this.props.onClick(...args)
690692

0 commit comments

Comments
 (0)