Merge pull request #19383 from KDSBrowne/27-zoom-jitter
fix: Improve Wheel Zoom Stability
This commit is contained in:
commit
e778f5857c
@ -252,6 +252,8 @@ export default function Whiteboard(props) {
|
|||||||
canvas.dispatchEvent(newEvent);
|
canvas.dispatchEvent(newEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.dispatchEvent(new Event('resize'));
|
||||||
}
|
}
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
@ -461,14 +463,6 @@ export default function Whiteboard(props) {
|
|||||||
}
|
}
|
||||||
}, [tldrawAPI?.getPageState()?.camera, presentationWidth, presentationHeight]);
|
}, [tldrawAPI?.getPageState()?.camera, presentationWidth, presentationHeight]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
if (isPresenter && slidePosition && tldrawAPI) {
|
|
||||||
const camera = tldrawAPI?.getPageState()?.camera;
|
|
||||||
const newZoom = calculateZoom(slidePosition?.viewBoxWidth, slidePosition?.viewBoxHeight);
|
|
||||||
tldrawAPI?.setCamera([camera?.point[0], camera?.point[1]], newZoom);
|
|
||||||
}
|
|
||||||
}, [slidePosition?.viewBoxWidth, slidePosition?.viewBoxHeight]);
|
|
||||||
|
|
||||||
// change tldraw camera when slidePosition changes
|
// change tldraw camera when slidePosition changes
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (tldrawAPI && !isPresenter && curPageId && slidePosition) {
|
if (tldrawAPI && !isPresenter && curPageId && slidePosition) {
|
||||||
|
Loading…
Reference in New Issue
Block a user