@@ -2,11 +2,13 @@ import React, { useRef, useEffect } from 'react';
22import PropTypes from 'prop-types' ;
33
44function createPopupClass ( ) {
5- function Popup ( { position, content, map } ) {
5+ function Popup ( { position, content, map, passThroughMouseEvents } ) {
66 this . position = position ;
77 this . containerDiv = content ;
88 this . setMap ( map ) ;
9- google . maps . OverlayView . preventMapHitsAndGesturesFrom ( this . containerDiv ) ;
9+ if ( ! passThroughMouseEvents ) {
10+ google . maps . OverlayView . preventMapHitsAndGesturesFrom ( this . containerDiv ) ;
11+ }
1012 }
1113
1214 Popup . prototype = Object . create ( google . maps . OverlayView . prototype ) ;
@@ -40,7 +42,15 @@ function createPopupClass() {
4042 return Popup ;
4143}
4244
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+ } ) => {
4454 const containerEl = useRef ( null ) ;
4555 useEffect ( ( ) => {
4656 if ( map ) {
@@ -49,7 +59,8 @@ const CustomPopup = ({ map, position, children, visible, google, className }) =>
4959 new Popup ( {
5060 position : pos ,
5161 content : containerEl . current ,
52- map
62+ map,
63+ passThroughMouseEvents
5364 } ) ;
5465 }
5566 } , [ map ] ) ;
@@ -70,7 +81,8 @@ CustomPopup.propTypes = {
7081 children : PropTypes . element . isRequired ,
7182 map : PropTypes . object ,
7283 position : PropTypes . object ,
73- visible : PropTypes . bool
84+ visible : PropTypes . bool ,
85+ passThroughMouseEvents : PropTypes . bool
7486} ;
7587
7688CustomPopup . defaultProps = {
0 commit comments