@@ -2,11 +2,13 @@ import React, { useRef, useEffect } from 'react';
2
2
import PropTypes from 'prop-types' ;
3
3
4
4
function createPopupClass ( ) {
5
- function Popup ( { position, content, map } ) {
5
+ function Popup ( { position, content, map, passThroughMouseEvents } ) {
6
6
this . position = position ;
7
7
this . containerDiv = content ;
8
8
this . setMap ( map ) ;
9
- google . maps . OverlayView . preventMapHitsAndGesturesFrom ( this . containerDiv ) ;
9
+ if ( ! passThroughMouseEvents ) {
10
+ google . maps . OverlayView . preventMapHitsAndGesturesFrom ( this . containerDiv ) ;
11
+ }
10
12
}
11
13
12
14
Popup . prototype = Object . create ( google . maps . OverlayView . prototype ) ;
@@ -40,7 +42,15 @@ function createPopupClass() {
40
42
return Popup ;
41
43
}
42
44
43
- const CustomPopup = ( { map, position, children, visible, google, className } ) => {
45
+ const CustomPopup = ( {
46
+ map,
47
+ position,
48
+ children,
49
+ visible,
50
+ google,
51
+ className,
52
+ passThroughMouseEvents
53
+ } ) => {
44
54
const containerEl = useRef ( null ) ;
45
55
useEffect ( ( ) => {
46
56
if ( map ) {
@@ -49,7 +59,8 @@ const CustomPopup = ({ map, position, children, visible, google, className }) =>
49
59
new Popup ( {
50
60
position : pos ,
51
61
content : containerEl . current ,
52
- map
62
+ map,
63
+ passThroughMouseEvents
53
64
} ) ;
54
65
}
55
66
} , [ map ] ) ;
@@ -70,7 +81,8 @@ CustomPopup.propTypes = {
70
81
children : PropTypes . element . isRequired ,
71
82
map : PropTypes . object ,
72
83
position : PropTypes . object ,
73
- visible : PropTypes . bool
84
+ visible : PropTypes . bool ,
85
+ passThroughMouseEvents : PropTypes . bool
74
86
} ;
75
87
76
88
CustomPopup . defaultProps = {
0 commit comments