Comments (2)
Maybe this can be used?
google.maps.OverlayView.preventMapHitsAndGesturesFrom(element)
from react-google-maps-api.
I finally figured this out.
const MapInfoWindow: React.FC<Props> = ({ position, children, style }) => {
const map = useGoogleMap();
if (map === null) {
throw new Error('MapInfoWindow cannot be used outside a google map context');
}
const myRef = useRef<HTMLDivElement>(null);
useEffect(() => {
if (myRef.current) {
// This prevents mouse and tocuh events to pass through the custom OverlayView to the map:
google.maps.OverlayView.preventMapHitsAndGesturesFrom(myRef.current);
}
}, [myRef]);
return (
<OverlayViewF
mapPaneName={'overlayMouseTarget'}
position={{
lat: position.lat,
lng: position.lng,
}}
>
<div
ref={myRef}
onContextMenu={(event) => {
// This stop the right click event from propagating, and will enable the native browser right click menu
event.stopPropagation();
}}
>
{children}
</div>
</OverlayViewF>
);
};
I'm writing my own "InfoBox" component based on the OverlayViewF
component, and therefore I don't need this to be handled in the "InfoBox" any longer. It still would be nice if this worked out of the box in my opinion, but I'll leave that to someone else ;)
from react-google-maps-api.
Related Issues (20)
- React Error: Maximum update depth exceeded after navigating back & forth with useJsApiLoader
- Site with a description of API does not work HOT 5
- how to disable map zoom when DirectionsRenderer redraws the path HOT 1
- onLoad prop return type error, but the map loads correctly
- MarkerClusterer onClick event doesn't have default click event params
- Custom controls
- Autocomplete not working on android browser, after useJsApiLoader execute the isLoaded not turned to true
- Doc link is broken HOT 4
- Document link is broken HOT 2
- Doc site not working HOT 1
- Loading google maps JS API HOT 7
- This page can't load Google Maps correctly. For developmental purposes only.
- Docs link broken HOT 3
- Marker will be discontinued on February 21, 2024. Please use google.maps.marker.AdvancedMarkerElement instead. For more information about the end of support, please visit https://developers.google.com/maps/deprecations. HOT 14
- Marker Icon Misalignment with Custom SVG Path in @react-google-maps/api
- 21st, 2024, google.maps.Marker is deprecated. HOT 4
- Docs website seems to be down HOT 5
- documentation website become gambling ads HOT 1
- README netlify link is showing scam games HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-google-maps-api.