Skip to content

Commit f22ca2c

Browse files
committed
update story book with example of OverlayViewF with bounds
1 parent 9fdfd80 commit f22ca2c

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

packages/react-google-maps-api/src/components/dom/OverlayView.stories.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ export default {
2121
component: OverlayViewF,
2222
} as ComponentMeta<typeof OverlayViewF>
2323

24+
2425
const getPixelPositionOffset = (width: number, height: number) => ({
2526
x: -(width / 2),
2627
y: -(height / 2),
2728
})
2829
const Template: ComponentStory<typeof OverlayViewF> = () => {
29-
return (
30+
const newZealand = new google.maps.LatLngBounds({lat: -46.641, lng: 166.509}, {lat: -34.450, lng: 178.517})
31+
return (
3032
<GoogleMap mapContainerStyle={mapContainerStyle} zoom={3} center={center}>
3133
{locations.map((location, index) => (
3234
<OverlayViewF
@@ -47,6 +49,23 @@ const Template: ComponentStory<typeof OverlayViewF> = () => {
4749
</div>
4850
</OverlayViewF>
4951
))}
52+
53+
<OverlayViewF
54+
mapPaneName={OVERLAY_LAYER}
55+
bounds={newZealand}
56+
position={{lat: -46.641, lng: 166.509}}
57+
>
58+
<div
59+
style={{
60+
width: '100%',
61+
height: '100%',
62+
backgroundColor: 'rgba(255,255,0,0.4)',
63+
fontSize: '12px',
64+
}}
65+
>
66+
Overlay with Bounds
67+
</div>
68+
</OverlayViewF>
5069
</GoogleMap>
5170
)
5271
}

0 commit comments

Comments
 (0)