Merge pull request #18267 from KDSBrowne/bbb-18231

fix: Whiteboard Crash When Switching Between Zoomed-In Slides
This commit is contained in:
Ramón Souza 2023-07-04 14:41:43 -03:00 committed by GitHub
commit 4b232b62a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -528,9 +528,9 @@ export default function Whiteboard(props) {
// Reset zoom to default when current presentation changes. // Reset zoom to default when current presentation changes.
React.useEffect(() => { React.useEffect(() => {
if (isPresenter && slidePosition && tldrawAPI) { if (isPresenter && slidePosition && tldrawAPI) {
tldrawAPI.zoomTo(0); tldrawAPI?.zoomTo(0);
setHistory(null); setHistory(null);
tldrawAPI.resetHistory(); tldrawAPI?.resetHistory();
} }
}, [curPres?.id]); }, [curPres?.id]);
@ -930,8 +930,8 @@ export default function Whiteboard(props) {
if (command && command?.id?.includes('change_page')) { if (command && command?.id?.includes('change_page')) {
const camera = tldrawAPI?.getPageState()?.camera; const camera = tldrawAPI?.getPageState()?.camera;
if (currentCameraPoint[app?.currentPageId]) { if (currentCameraPoint[app?.currentPageId] && camera) {
tldrawAPI?.setCamera([currentCameraPoint[app?.currentPageId][0], currentCameraPoint[app?.currentPageId][1]], camera.zoom); tldrawAPI?.setCamera([currentCameraPoint[app?.currentPageId][0], currentCameraPoint[app?.currentPageId][1]], camera?.zoom);
} }
} }