Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
fix: rendering bug in new layer system (#375)
Browse files Browse the repository at this point in the history
* fix: rendering bug in new layer system

* feat: upgrade resium

* chore: use exact version
  • Loading branch information
keiya01 committed Dec 15, 2022
1 parent 4abbbac commit 172988e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
"react-spinners": "0.13.7",
"react-use": "17.4.0",
"remark-gfm": "3.0.1",
"resium": "1.15.1",
"resium": "1.16.0",
"tinycolor2": "1.4.2",
"ts-easing": "0.2.0",
"use-callback-ref": "1.3.0",
Expand Down
7 changes: 7 additions & 0 deletions src/core/engines/Cesium/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,12 @@ export default ({
viewer.scene.requestRender();
});

const handleUpdate = useCallback(() => {
const viewer = cesium.current?.cesiumElement;
if (!viewer || viewer.isDestroyed()) return;
viewer.scene.requestRender();
}, []);

// enable Drag and Drop Layers
const handleLayerDrag = useCallback(
(e: Entity, position: Cartesian3 | undefined, _context: Context): boolean | void => {
Expand Down Expand Up @@ -337,6 +343,7 @@ export default ({
mouseEventHandles,
handleMount,
handleUnmount,
handleUpdate,
handleClick,
handleCameraChange,
handleCameraMoveEnd,
Expand Down
2 changes: 2 additions & 0 deletions src/core/engines/Cesium/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const Cesium: React.ForwardRefRenderFunction<EngineRef, EngineProps> = (
cesiumIonAccessToken,
handleMount,
handleUnmount,
handleUpdate,
handleClick,
handleCameraChange,
handleCameraMoveEnd,
Expand All @@ -82,6 +83,7 @@ const Cesium: React.ForwardRefRenderFunction<EngineRef, EngineProps> = (
<featureContext.Provider value={context}>
<Viewer
ref={cesium}
onUpdate={handleUpdate}
className={className}
animation
timeline
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16265,10 +16265,10 @@ requires-port@^1.0.0:
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==

resium@1.15.1:
version "1.15.1"
resolved "https://registry.yarnpkg.com/resium/-/resium-1.15.1.tgz#a2eee681f815e5978eb77b78122a853cbac69165"
integrity sha512-FDRl6WUyYin+yhs6uAFKqCvI75rawMBfld/yF0V5A+YeCyKP1mt6Bx5v+lCCJaZl4RUOvQ3i3wJJUhuGsxpvYA==
resium@1.16.0:
version "1.16.0"
resolved "https://registry.yarnpkg.com/resium/-/resium-1.16.0.tgz#9a9561c1736456211a91f6f06c191623f164b994"
integrity sha512-cEiIuXzfTS4TRerD4ucaYQAb1exX3YUw4xrONpzSb1pAkmku//xsfCCsD7xR2hG39Zk1WJTEO74Mu6homvTR6Q==

resize-observer-polyfill@^1.5.1:
version "1.5.1"
Expand Down

0 comments on commit 172988e

Please sign in to comment.