@mapcomponents/deck-gl 1.8.8 → 1.8.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"MlHexagonLayer.d.ts","sourceRoot":"","sources":["../../../src/components/MlHexagonLayer/MlHexagonLayer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAgB,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAI9E,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC3D;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAwBD,QAAA,MAAM,cAAc,GAAI,OAAO,iBAAiB,4CAgD/C,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"MlHexagonLayer.d.ts","sourceRoot":"","sources":["../../../src/components/MlHexagonLayer/MlHexagonLayer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAgB,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAI9E,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC3D;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAwBD,QAAA,MAAM,cAAc,GAAI,OAAO,iBAAiB,4CAyC/C,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"MlScenegraphLayer.d.ts","sourceRoot":"","sources":["../../../src/components/MlSceneGraphLayer/MlScenegraphLayer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmB,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAK7E,MAAM,WAAW,sBAAuB,SAAQ,oBAAoB;IACnE;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,QAAA,MAAM,iBAAiB,GAAI,OAAO,sBAAsB,4CA2BvD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"MlScenegraphLayer.d.ts","sourceRoot":"","sources":["../../../src/components/MlSceneGraphLayer/MlScenegraphLayer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmB,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAK7E,MAAM,WAAW,sBAAuB,SAAQ,oBAAoB;IACnE;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,QAAA,MAAM,iBAAiB,GAAI,OAAO,sBAAsB,4CAwBvD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),n=require("react"),u=require("@mapcomponents/react-maplibre"),m=require("@deck.gl/mapbox"),f=require("@deck.gl/aggregation-layers"),L=require("@deck.gl/geo-layers"),g=require("@deck.gl/mesh-layers"),k="deckgl-layer",y=n.createContext({}),v=({mapId:a,children:s})=>{const r=u.useMap({mapId:a}),e=n.useRef(void 0),[o,t]=n.useState([]),[c,i]=n.useState([]);n.useEffect(()=>{if(r.map)return e.current=new m.MapboxOverlay({id:k,interleaved:!0}),r.map.addControl(e.current),()=>{e.current&&r.map?.removeControl(e.current),e.current=void 0}},[r.map]),n.useEffect(()=>{e.current&&e.current.setProps({layers:[...o],effects:[...c]})},[o,c]);const p={deckGlLayerArray:o,setDeckGlLayerArray:t,deckGlEffectArray:c,setDeckGlEffectArray:i};return l.jsx(y.Provider,{value:p,children:s})};function d(){const a=n.useContext(y);function s(t){a.setDeckGlEffectArray(c=>[...c,t])}function r(t){a.setDeckGlEffectArray(c=>c.filter(i=>i!==t))}function e(t){a.setDeckGlLayerArray(c=>[...c,t])}function o(t){a.setDeckGlLayerArray(c=>c.filter(i=>i!==t))}return{addEffect:s,removeEffect:r,addLayer:e,removeLayer:o}}const x={type:f.HexagonLayer,layerOpacity:.8,elevationRange:[30,75],elevationScale:1,extruded:!0,coverage:.9,autoHighlight:!1,material:{ambient:.6,diffuse:.5,shininess:10},radius:16,transitions:{elevationScale:1500},_filterData:null,colorRange:[[1,152,189,125],[73,227,206,150],[216,254,181,175],[254,237,177,200],[254,173,84,225],[209,55,78,255]]},G=a=>{const s=d();a={...x,...a};const{mapId:r,...e}=a,o=u.useMap({mapId:r,waitForLayer:e.beforeId}),t=n.useMemo(()=>e.data?new f.HexagonLayer({...e}):null,[e.beforeId,e.data,e.elevationScale,e.extruded,e.coverage,e.autoHighlight,e.material,e.radius,e.transitions]);return n.useEffect(()=>{if(!(!o.map||!t))return s.addLayer(t),()=>{s.removeLayer(t)}},[o.map,t]),l.jsx(l.Fragment,{})},D=a=>{const{mapId:s,...r}=a,e=u.useMap({mapId:s}),o=d(),t=n.useMemo(()=>r.data?new L.Tile3DLayer({...r}):null,[r.data,r.id,r.pickable,r.onTileLoad,r.onTileUnload,r.loadOptions,r.loaders,r.visible,r.opacity,r.pointSize,r.beforeId]);return n.useEffect(()=>{if(!(!e.map||!t))return o.addLayer(t),()=>{t&&o.removeLayer(t)}},[e.map,t]),l.jsx(l.Fragment,{})},M=a=>{const{mapId:s,...r}=a,e=u.useMap({mapId:s,waitForLayer:r.beforeId}),o=d(),t=n.useMemo(()=>new g.ScenegraphLayer({...r}),[r]);return n.useEffect(()=>{if(!(!e.map||!t))return o.addLayer(t),()=>{t&&o.removeLayer(t)}},[e.map,t]),l.jsx(l.Fragment,{})};exports.DeckGlContext=y;exports.DeckGlContextProvider=v;exports.Ml3DTileLayer=D;exports.MlHexagonLayer=G;exports.MlSceneGraphLayer=M;exports.useDeckGl=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),n=require("react"),i=require("@mapcomponents/react-maplibre"),L=require("@deck.gl/mapbox"),f=require("@deck.gl/aggregation-layers"),g=require("@deck.gl/geo-layers"),k=require("@deck.gl/mesh-layers"),v="deckgl-layer",y=n.createContext({}),x=({mapId:e,children:o})=>{const r=i.useMap({mapId:e}),t=n.useRef(void 0),[s,a]=n.useState([]),[c,u]=n.useState([]);n.useEffect(()=>{if(r.map)return t.current=new L.MapboxOverlay({id:v,interleaved:!0}),r.map.addControl(t.current),()=>{t.current&&r.map?.removeControl(t.current),t.current=void 0}},[r.map]),n.useEffect(()=>{t.current&&t.current.setProps({layers:[...s],effects:[...c]})},[s,c]);const m={deckGlLayerArray:s,setDeckGlLayerArray:a,deckGlEffectArray:c,setDeckGlEffectArray:u};return l.jsx(y.Provider,{value:m,children:o})};function d(){const e=n.useContext(y);function o(a){e.setDeckGlEffectArray(c=>[...c,a])}function r(a){e.setDeckGlEffectArray(c=>c.filter(u=>u!==a))}function t(a){e.setDeckGlLayerArray(c=>[...c,a])}function s(a){e.setDeckGlLayerArray(c=>c.filter(u=>u!==a))}return{addEffect:o,removeEffect:r,addLayer:t,removeLayer:s}}const p={type:f.HexagonLayer,layerOpacity:.8,elevationRange:[30,75],elevationScale:1,extruded:!0,coverage:.9,autoHighlight:!1,material:{ambient:.6,diffuse:.5,shininess:10},radius:16,transitions:{elevationScale:1500},_filterData:null,colorRange:[[1,152,189,125],[73,227,206,150],[216,254,181,175],[254,237,177,200],[254,173,84,225],[209,55,78,255]]},G=e=>{const o=d(),r=i.useMap({mapId:e.mapId,waitForLayer:e.beforeId}),t=n.useMemo(()=>{const{mapId:s,...a}=e;return a.data?new f.HexagonLayer({...p,...a}):null},[e.beforeId,e.data,e.elevationScale,e.extruded,e.coverage,e.autoHighlight,e.material,e.radius,e.transitions]);return n.useEffect(()=>{if(!(!r.map||!t))return o.addLayer(t),()=>{o.removeLayer(t)}},[r.map,t]),l.jsx(l.Fragment,{})},D=e=>{const{mapId:o,...r}=e,t=i.useMap({mapId:o}),s=d(),a=n.useMemo(()=>r.data?new g.Tile3DLayer({...r}):null,[r.data,r.id,r.pickable,r.onTileLoad,r.onTileUnload,r.loadOptions,r.loaders,r.visible,r.opacity,r.pointSize,r.beforeId]);return n.useEffect(()=>{if(!(!t.map||!a))return s.addLayer(a),()=>{a&&s.removeLayer(a)}},[t.map,a]),l.jsx(l.Fragment,{})},M=e=>{const o=i.useMap({mapId:e.mapId,waitForLayer:e.beforeId}),r=d(),t=n.useMemo(()=>{const{mapId:s,...a}=e;return new k.ScenegraphLayer({...a})},[e]);return n.useEffect(()=>{if(!(!o.map||!t))return r.addLayer(t),()=>{t&&r.removeLayer(t)}},[o.map,t]),l.jsx(l.Fragment,{})};exports.DeckGlContext=y;exports.DeckGlContextProvider=x;exports.Ml3DTileLayer=D;exports.MlHexagonLayer=G;exports.MlSceneGraphLayer=M;exports.useDeckGl=d;
package/dist/index.mjs CHANGED
@@ -1,57 +1,57 @@
1
- import { jsx as s, Fragment as u } from "react/jsx-runtime";
2
- import v, { useRef as g, useState as m, useEffect as i, useContext as G, useMemo as f } from "react";
3
- import { useMap as d } from "@mapcomponents/react-maplibre";
1
+ import { jsx as d, Fragment as s } from "react/jsx-runtime";
2
+ import p, { useRef as g, useState as y, useEffect as i, useContext as G, useMemo as f } from "react";
3
+ import { useMap as u } from "@mapcomponents/react-maplibre";
4
4
  import { MapboxOverlay as x } from "@deck.gl/mapbox";
5
- import { HexagonLayer as p } from "@deck.gl/aggregation-layers";
6
- import { Tile3DLayer as D } from "@deck.gl/geo-layers";
7
- import { ScenegraphLayer as H } from "@deck.gl/mesh-layers";
8
- const h = "deckgl-layer", L = v.createContext({}), w = ({ mapId: a, children: c }) => {
9
- const r = d({ mapId: a }), e = g(void 0), [o, t] = m([]), [n, l] = m([]);
5
+ import { HexagonLayer as L } from "@deck.gl/aggregation-layers";
6
+ import { Tile3DLayer as I } from "@deck.gl/geo-layers";
7
+ import { ScenegraphLayer as D } from "@deck.gl/mesh-layers";
8
+ const H = "deckgl-layer", k = p.createContext({}), w = ({ mapId: e, children: n }) => {
9
+ const r = u({ mapId: e }), t = g(void 0), [c, a] = y([]), [o, l] = y([]);
10
10
  i(() => {
11
11
  if (r.map)
12
- return e.current = new x({
13
- id: h,
12
+ return t.current = new x({
13
+ id: H,
14
14
  interleaved: !0
15
- }), r.map.addControl(e.current), () => {
16
- e.current && r.map?.removeControl(e.current), e.current = void 0;
15
+ }), r.map.addControl(t.current), () => {
16
+ t.current && r.map?.removeControl(t.current), t.current = void 0;
17
17
  };
18
18
  }, [r.map]), i(() => {
19
- e.current && e.current.setProps({
20
- layers: [...o],
21
- effects: [...n]
19
+ t.current && t.current.setProps({
20
+ layers: [...c],
21
+ effects: [...o]
22
22
  });
23
- }, [o, n]);
24
- const k = {
25
- deckGlLayerArray: o,
26
- setDeckGlLayerArray: t,
27
- deckGlEffectArray: n,
23
+ }, [c, o]);
24
+ const v = {
25
+ deckGlLayerArray: c,
26
+ setDeckGlLayerArray: a,
27
+ deckGlEffectArray: o,
28
28
  setDeckGlEffectArray: l
29
29
  };
30
- return /* @__PURE__ */ s(L.Provider, { value: k, children: c });
30
+ return /* @__PURE__ */ d(k.Provider, { value: v, children: n });
31
31
  };
32
- function y() {
33
- const a = G(L);
34
- function c(t) {
35
- a.setDeckGlEffectArray((n) => [...n, t]);
32
+ function m() {
33
+ const e = G(k);
34
+ function n(a) {
35
+ e.setDeckGlEffectArray((o) => [...o, a]);
36
36
  }
37
- function r(t) {
38
- a.setDeckGlEffectArray((n) => n.filter((l) => l !== t));
37
+ function r(a) {
38
+ e.setDeckGlEffectArray((o) => o.filter((l) => l !== a));
39
39
  }
40
- function e(t) {
41
- a.setDeckGlLayerArray((n) => [...n, t]);
40
+ function t(a) {
41
+ e.setDeckGlLayerArray((o) => [...o, a]);
42
42
  }
43
- function o(t) {
44
- a.setDeckGlLayerArray((n) => n.filter((l) => l !== t));
43
+ function c(a) {
44
+ e.setDeckGlLayerArray((o) => o.filter((l) => l !== a));
45
45
  }
46
46
  return {
47
- addEffect: c,
47
+ addEffect: n,
48
48
  removeEffect: r,
49
- addLayer: e,
50
- removeLayer: o
49
+ addLayer: t,
50
+ removeLayer: c
51
51
  };
52
52
  }
53
- const S = {
54
- type: p,
53
+ const h = {
54
+ type: L,
55
55
  layerOpacity: 0.8,
56
56
  elevationRange: [30, 75],
57
57
  elevationScale: 1,
@@ -70,18 +70,17 @@ const S = {
70
70
  [254, 173, 84, 225],
71
71
  [209, 55, 78, 255]
72
72
  ]
73
- }, R = (a) => {
74
- const c = y();
75
- a = {
76
- ...S,
77
- ...a
78
- };
79
- const { mapId: r, ...e } = a, o = d({
80
- mapId: r,
73
+ }, R = (e) => {
74
+ const n = m(), r = u({
75
+ mapId: e.mapId,
81
76
  waitForLayer: e.beforeId
82
- }), t = f(() => e.data ? new p({
83
- ...e
84
- }) : null, [
77
+ }), t = f(() => {
78
+ const { mapId: c, ...a } = e;
79
+ return a.data ? new L({
80
+ ...h,
81
+ ...a
82
+ }) : null;
83
+ }, [
85
84
  e.beforeId,
86
85
  e.data,
87
86
  e.elevationScale,
@@ -93,13 +92,13 @@ const S = {
93
92
  e.transitions
94
93
  ]);
95
94
  return i(() => {
96
- if (!(!o.map || !t))
97
- return c.addLayer(t), () => {
98
- c.removeLayer(t);
95
+ if (!(!r.map || !t))
96
+ return n.addLayer(t), () => {
97
+ n.removeLayer(t);
99
98
  };
100
- }, [o.map, t]), /* @__PURE__ */ s(u, {});
101
- }, T = (a) => {
102
- const { mapId: c, ...r } = a, e = d({ mapId: c }), o = y(), t = f(() => r.data ? new D({
99
+ }, [r.map, t]), /* @__PURE__ */ d(s, {});
100
+ }, T = (e) => {
101
+ const { mapId: n, ...r } = e, t = u({ mapId: n }), c = m(), a = f(() => r.data ? new I({
103
102
  ...r
104
103
  }) : null, [
105
104
  r.data,
@@ -115,33 +114,33 @@ const S = {
115
114
  r.beforeId
116
115
  ]);
117
116
  return i(() => {
118
- if (!(!e.map || !t))
119
- return o.addLayer(t), () => {
120
- t && o.removeLayer(t);
117
+ if (!(!t.map || !a))
118
+ return c.addLayer(a), () => {
119
+ a && c.removeLayer(a);
121
120
  };
122
- }, [e.map, t]), /* @__PURE__ */ s(u, {});
123
- }, F = (a) => {
124
- const { mapId: c, ...r } = a, e = d({
125
- mapId: c,
126
- waitForLayer: r.beforeId
127
- }), o = y(), t = f(
128
- () => new H({
129
- ...r
130
- }),
131
- [r]
132
- );
121
+ }, [t.map, a]), /* @__PURE__ */ d(s, {});
122
+ }, F = (e) => {
123
+ const n = u({
124
+ mapId: e.mapId,
125
+ waitForLayer: e.beforeId
126
+ }), r = m(), t = f(() => {
127
+ const { mapId: c, ...a } = e;
128
+ return new D({
129
+ ...a
130
+ });
131
+ }, [e]);
133
132
  return i(() => {
134
- if (!(!e.map || !t))
135
- return o.addLayer(t), () => {
136
- t && o.removeLayer(t);
133
+ if (!(!n.map || !t))
134
+ return r.addLayer(t), () => {
135
+ t && r.removeLayer(t);
137
136
  };
138
- }, [e.map, t]), /* @__PURE__ */ s(u, {});
137
+ }, [n.map, t]), /* @__PURE__ */ d(s, {});
139
138
  };
140
139
  export {
141
- L as DeckGlContext,
140
+ k as DeckGlContext,
142
141
  w as DeckGlContextProvider,
143
142
  T as Ml3DTileLayer,
144
143
  R as MlHexagonLayer,
145
144
  F as MlSceneGraphLayer,
146
- y as useDeckGl
145
+ m as useDeckGl
147
146
  };
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapcomponents/deck-gl",
3
- "version": "1.8.8",
3
+ "version": "1.8.10",
4
4
  "description": "",
5
5
  "main": "src/index.ts",
6
6
  "module": "dist/index.mjs",
@@ -9,9 +9,12 @@
9
9
  "test": "echo \"Error: no test specified\" && exit 1"
10
10
  },
11
11
  "dependencies": {
12
+ "@emotion/react": "^11.14.0",
13
+ "@emotion/styled": "^11.14.1",
12
14
  "@mui/icons-material": "^7.3.2",
15
+ "@mui/system": "^7.3.2",
13
16
  "@mui/material": "^7.3.2",
14
- "@storybook/react": "^9.1.4",
17
+ "@storybook/react": "^9.1.20",
15
18
  "uuid": "^11.1.0"
16
19
  },
17
20
  "peerDependencies": {
package/package.json CHANGED
@@ -1,14 +1,17 @@
1
1
  {
2
2
  "name": "@mapcomponents/deck-gl",
3
- "version": "1.8.8",
3
+ "version": "1.8.10",
4
4
  "description": "",
5
5
  "main": "src/index.ts",
6
6
  "module": "dist/index.mjs",
7
7
  "license": "MIT",
8
8
  "dependencies": {
9
+ "@emotion/react": "^11.14.0",
10
+ "@emotion/styled": "^11.14.1",
9
11
  "@mui/icons-material": "^7.3.2",
12
+ "@mui/system": "^7.3.2",
10
13
  "@mui/material": "^7.3.2",
11
- "@storybook/react": "^9.1.4",
14
+ "@storybook/react": "^9.1.20",
12
15
  "uuid": "^11.1.0"
13
16
  },
14
17
  "peerDependencies": {
@@ -18,7 +21,7 @@
18
21
  "@deck.gl/mapbox": "^9.2.6",
19
22
  "@deck.gl/mesh-layers": "^9.2.6",
20
23
  "maplibre-gl": "^5.16.0",
21
- "@mapcomponents/react-maplibre": "1.8.8"
24
+ "@mapcomponents/react-maplibre": "1.8.10"
22
25
  },
23
26
  "devDependencies": {
24
27
  "@types/geojson": "^7946.0.16"
@@ -23,7 +23,6 @@ PointCloudExample.parameters = {
23
23
  },
24
24
  };
25
25
  PointCloudExample.args = {
26
- mapId: 'map_1',
27
26
  id: 'PointCould',
28
27
  data: 'assets/tiles/tileset.json',
29
28
  pointSize: 2,
@@ -38,6 +37,5 @@ HamburgExample.parameters = {
38
37
  },
39
38
  };
40
39
  HamburgExample.args = {
41
- mapId: 'map_1',
42
40
  data: 'https://3dtiles.wheregroup.com/tileset.json',
43
41
  };
@@ -69,7 +69,6 @@ const Template = (context: any) => {
69
69
  export const DefaultSettings: { [key: string]: any } = Template.bind({});
70
70
  DefaultSettings.parameters = {};
71
71
  DefaultSettings.args = {
72
- mapId: 'map_1',
73
72
  type: HexagonLayer,
74
73
  layerOpacity: 0.8,
75
74
  elevationRange: [30, 75],
@@ -93,7 +92,6 @@ DefaultSettings.args = {
93
92
  export const CustomColorAndHeightProfile: { [key: string]: any } = Template.bind({});
94
93
  CustomColorAndHeightProfile.parameters = {};
95
94
  CustomColorAndHeightProfile.args = {
96
- mapId: 'map_1',
97
95
  type: HexagonLayer,
98
96
  layerOpacity: 0.8,
99
97
  specularColor: [51, 51, 51],
@@ -40,38 +40,31 @@ const defaultProps = {
40
40
  const MlHexagonLayer = (props: MlHexagonMapProps) => {
41
41
  const deckGlHook = useDeckGl();
42
42
 
43
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
44
- // @ts-expect-error
45
- props = {
46
- ...defaultProps,
47
- ...props,
48
- };
49
-
50
- const { mapId, ...HexagonLayerProps } = props;
51
-
52
43
  const mapHook = useMap({
53
- mapId: mapId,
54
- waitForLayer: HexagonLayerProps.beforeId,
44
+ mapId: props.mapId,
45
+ waitForLayer: props.beforeId,
55
46
  });
56
47
 
57
48
  // create deck.gl HexagonLayer once when its props change
58
49
  const hexagonLayer = useMemo(() => {
50
+ const { mapId: _mapId, ...HexagonLayerProps } = props;
59
51
  if (!HexagonLayerProps.data) return null;
60
52
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
61
53
  // @ts-ignore
62
54
  return new HexagonLayer({
55
+ ...defaultProps,
63
56
  ...HexagonLayerProps,
64
57
  } as unknown as HexagonLayerProps);
65
58
  }, [
66
- HexagonLayerProps.beforeId,
67
- HexagonLayerProps.data,
68
- HexagonLayerProps.elevationScale,
69
- HexagonLayerProps.extruded,
70
- HexagonLayerProps.coverage,
71
- HexagonLayerProps.autoHighlight,
72
- HexagonLayerProps.material,
73
- HexagonLayerProps.radius,
74
- HexagonLayerProps.transitions,
59
+ props.beforeId,
60
+ props.data,
61
+ props.elevationScale,
62
+ props.extruded,
63
+ props.coverage,
64
+ props.autoHighlight,
65
+ props.material,
66
+ props.radius,
67
+ props.transitions,
75
68
  ]);
76
69
 
77
70
  // add/remove the memoized layer
@@ -78,7 +78,6 @@ DeckglExample.parameters = {
78
78
  },
79
79
  };
80
80
  DeckglExample.args = {
81
- mapId: 'map_1',
82
81
  id: 'ScenegraphLayer',
83
82
  data: 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/bart-stations.json',
84
83
  getPosition: (d: BartStation) => d.coordinates,
@@ -102,7 +101,6 @@ WhereGroupLocationExample.parameters = {
102
101
  },
103
102
  };
104
103
  WhereGroupLocationExample.args = {
105
- mapId: 'map_1',
106
104
  id: 'ScenegraphLayer',
107
105
  data: wgLocations,
108
106
  getPosition: (d: any) => d.geometry.coordinates,
@@ -16,20 +16,17 @@ export interface MlScenegraphLayerProps extends ScenegraphLayerProps {
16
16
  }
17
17
 
18
18
  const MlScenegraphLayer = (props: MlScenegraphLayerProps) => {
19
- const { mapId, ...ScenegraphLayerProps } = props;
20
-
21
19
  const mapHook = useMap({
22
- mapId: mapId,
23
- waitForLayer: ScenegraphLayerProps.beforeId,
20
+ mapId: props.mapId,
21
+ waitForLayer: props.beforeId,
24
22
  });
25
23
  const deckGlHook = useDeckGl();
26
- const scenegraphLayer = useMemo(
27
- () =>
28
- new ScenegraphLayer({
29
- ...ScenegraphLayerProps,
30
- }),
31
- [ScenegraphLayerProps]
32
- );
24
+ const scenegraphLayer = useMemo(() => {
25
+ const { mapId: _mapId, ...ScenegraphLayerProps } = props;
26
+ return new ScenegraphLayer({
27
+ ...ScenegraphLayerProps,
28
+ });
29
+ }, [props]);
33
30
 
34
31
  useEffect(() => {
35
32
  if (!mapHook.map || !scenegraphLayer) return;
package/vite.config.ts CHANGED
@@ -9,6 +9,16 @@ import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
9
9
  export default defineConfig(() => ({
10
10
  root: __dirname,
11
11
  cacheDir: '../../node_modules/.vite/packages/deck-gl',
12
+ resolve: {
13
+ dedupe: [
14
+ 'react',
15
+ 'react-dom',
16
+ '@mui/material',
17
+ '@mui/system',
18
+ '@emotion/react',
19
+ '@emotion/styled',
20
+ ],
21
+ },
12
22
  plugins: [
13
23
  react(),
14
24
  nxViteTsPaths(),
@@ -50,6 +60,11 @@ export default defineConfig(() => ({
50
60
  '@deck.gl/geo-layers',
51
61
  '@deck.gl/mapbox',
52
62
  '@deck.gl/mesh-layers',
63
+ '@mui/material',
64
+ '@mui/system',
65
+ '@mui/icons-material',
66
+ '@emotion/react',
67
+ '@emotion/styled',
53
68
  ],
54
69
  },
55
70
  },