Merge pull request #16169 from JoVictorNunes/issue-16140

feat(whiteboard): reset zoom when switching presentation
This commit is contained in:
Anton Georgiev 2022-12-22 14:10:46 -05:00 committed by GitHub
commit 9184a16690
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -452,6 +452,14 @@ export default function Whiteboard(props) {
tldrawAPI?.setSetting('language', language);
}, [language]);
// Reset zoom to default when current presentation changes.
React.useEffect(() => {
if (isPresenter && slidePosition && tldrawAPI) {
const zoom = calculateZoom(slidePosition.width, slidePosition.height);
tldrawAPI.zoomTo(zoom);
}
}, [curPres?.id]);
const onMount = (app) => {
const menu = document.getElementById("TD-Styles")?.parentElement;
if (menu) {