Skip to content

Commit 1e9ae7e

Browse files
authored
docs: update map-3d example for react-19 (visgl#680)
1 parent 4fb2829 commit 1e9ae7e

File tree

2 files changed

+7
-22
lines changed

2 files changed

+7
-22
lines changed

examples/map-3d/src/map-3d/map-3d-types.ts

+2-9
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,18 @@ declare module '@vis.gl/react-google-maps' {
1010

1111
// add the <gmp-map-3d> custom-element to the JSX.IntrinsicElements
1212
// interface, so it can be used in jsx
13-
declare global {
13+
declare module 'react' {
1414
// eslint-disable-next-line @typescript-eslint/no-namespace
1515
namespace JSX {
1616
interface IntrinsicElements {
1717
['gmp-map-3d']: CustomElement<
1818
google.maps.maps3d.Map3DElement,
19-
{
20-
[key in GmpMap3DAttributeNames]?: string;
21-
}
19+
google.maps.maps3d.Map3DElement
2220
>;
2321
}
2422
}
2523
}
2624

27-
type GmpMap3DAttributeNames = keyof Omit<
28-
google.maps.maps3d.Map3DElementOptions,
29-
'bounds'
30-
>;
31-
3225
// a helper type for CustomElement definitions
3326
type CustomElement<TElem, TAttr> = Partial<
3427
TAttr &

examples/map-3d/src/map-3d/map-3d.tsx

+5-13
Original file line numberDiff line numberDiff line change
@@ -61,24 +61,16 @@ export const Map3D = forwardRef(
6161
google.maps.maps3d.Map3DElement | null
6262
>(forwardedRef, () => map3DElement, [map3DElement]);
6363

64-
const centerString = useMemo(() => {
65-
const lat = center?.lat ?? 0.0;
66-
const lng = center?.lng ?? 0.0;
67-
const altitude = center?.altitude ?? 0.0;
68-
69-
return [lat, lng, altitude].join(',');
70-
}, [center?.lat, center?.lng, center?.altitude]);
71-
7264
if (!customElementsReady) return null;
7365

7466
return (
7567
<gmp-map-3d
7668
ref={map3dRef}
77-
center={centerString}
78-
range={String(props.range)}
79-
heading={String(props.heading)}
80-
tilt={String(props.tilt)}
81-
roll={String(props.roll)}></gmp-map-3d>
69+
center={center}
70+
range={props.range}
71+
heading={props.heading}
72+
tilt={props.tilt}
73+
roll={props.roll}></gmp-map-3d>
8274
);
8375
}
8476
);

0 commit comments

Comments
 (0)