Skip to content

Commit

Permalink
Merge pull request #78 from yushiang-demo/fix-viewer-runtime-error
Browse files Browse the repository at this point in the history
fix-viewer-runtime-error
  • Loading branch information
tsengyushiang committed Mar 5, 2024
2 parents d45dab8 + f1b71ef commit 8ae6ead
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ The format is based on [Keep a Changelog](https://github.com/olivierlacan/keep-a

### Fixed

- Fix `decoration`, `viewer` pages runtime error. (https://github.com/yushiang-demo/pano-to-mesh/pull/78)

### Removed

## [2.1.1] - 2024-03-05
Expand Down
4 changes: 3 additions & 1 deletion apps/editors/decoration/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const Editor = ({ data }) => {
}, []);

useEffect(() => {
threeRef.current.cameraControls.setEnable(mode === MODE.SELECT);
threeRef.current?.cameraControls.setEnable(mode === MODE.SELECT);
}, [mode]);

const focusedMedia = media[focusedIndex];
Expand Down Expand Up @@ -153,6 +153,8 @@ const Editor = ({ data }) => {
[focusedIndex]
);

if (!panorama) return null;

return (
<>
<ThreeCanvas dev={dev} ref={threeRef} {...eventHandlers}>
Expand Down
2 changes: 2 additions & 0 deletions apps/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ const Viewer = ({ data }) => {
);
});

if (!panorama) return null;

return (
<>
<ThreeCanvas dev={dev} ref={threeRef} {...eventsHandlers}>
Expand Down

0 comments on commit 8ae6ead

Please sign in to comment.