@reearth/core 0.0.7-alpha.17 → 0.0.7-alpha.18
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.
- package/dist/core.js +1789 -1766
- package/dist/core.umd.cjs +35 -35
- package/package.json +1 -1
- package/src/engines/Cesium/Feature/Tileset/hooks.ts +23 -1
package/package.json
CHANGED
|
@@ -500,8 +500,9 @@ export const useHooks = ({
|
|
|
500
500
|
return prevPlanes.current;
|
|
501
501
|
}, [_planes]);
|
|
502
502
|
const clipDirection = direction === "inside" ? -1 : 1;
|
|
503
|
+
|
|
503
504
|
// Create immutable object
|
|
504
|
-
const [clippingPlanes] = useState(
|
|
505
|
+
const [clippingPlanes, setClippingPlanes] = useState<CesiumClippingPlaneCollection>(
|
|
505
506
|
() =>
|
|
506
507
|
new CesiumClippingPlaneCollection({
|
|
507
508
|
planes: planes?.map(
|
|
@@ -516,6 +517,27 @@ export const useHooks = ({
|
|
|
516
517
|
edgeColor: toColor(edgeColor),
|
|
517
518
|
}),
|
|
518
519
|
);
|
|
520
|
+
// Initialize clipping planes
|
|
521
|
+
// This is workaround to reinitialize ClippingPlanes in strict mode.
|
|
522
|
+
useEffect(
|
|
523
|
+
() => () => {
|
|
524
|
+
setClippingPlanes(
|
|
525
|
+
new CesiumClippingPlaneCollection({
|
|
526
|
+
planes: planes?.map(
|
|
527
|
+
plane =>
|
|
528
|
+
new ClippingPlane(
|
|
529
|
+
new Cartesian3(plane.normal?.x, plane.normal?.y, plane.normal?.z),
|
|
530
|
+
(plane.distance || 0) * clipDirection,
|
|
531
|
+
),
|
|
532
|
+
),
|
|
533
|
+
unionClippingRegions: direction === "outside",
|
|
534
|
+
edgeWidth: edgeWidth,
|
|
535
|
+
edgeColor: toColor(edgeColor),
|
|
536
|
+
}),
|
|
537
|
+
);
|
|
538
|
+
},
|
|
539
|
+
[], // eslint-disable-line react-hooks/exhaustive-deps
|
|
540
|
+
);
|
|
519
541
|
|
|
520
542
|
const { drawClippingEnabled, drawClippingEdgeProps } = useDrawClipping({
|
|
521
543
|
...experimental_clipping?.draw,
|