Skip to content

Commit c15b693

Browse files
authored
Merge pull request #140 from reearth/fix/verticalExaggeration
fix: guard verticalExaggeration against undefined to prevent Cesium crash
2 parents 16ead38 + 63a4adc commit c15b693

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/engines/Cesium/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ const Cesium: React.ForwardRefRenderFunction<EngineRef, EngineProps> = (
121121
onCreditsUpdate,
122122
});
123123

124+
const verticalExaggeration = property?.terrain?.enabled
125+
? (property?.scene?.verticalExaggeration ?? 1)
126+
: 1;
127+
124128
return (
125129
<Viewer
126130
ref={cesium}
@@ -253,9 +257,7 @@ const Cesium: React.ForwardRefRenderFunction<EngineRef, EngineProps> = (
253257
useWebVR={!!property?.scene?.vr || undefined} // NOTE: useWebVR={false} will crash Cesium
254258
debugShowFramesPerSecond={!!property?.debug?.showFramesPerSecond}
255259
verticalExaggerationRelativeHeight={property?.scene?.verticalExaggerationRelativeHeight}
256-
verticalExaggeration={
257-
property?.terrain?.enabled ? property?.scene?.verticalExaggeration : 1
258-
}
260+
verticalExaggeration={verticalExaggeration}
259261
/>
260262
<SkyBox show={property?.sky?.skyBox?.show ?? true} />
261263
<Fog enabled={property?.sky?.fog?.enabled ?? true} density={property?.sky?.fog?.density} />

0 commit comments

Comments
 (0)