small cleanup

This commit is contained in:
barnabasmolnar 2023-08-08 15:12:24 +02:00
parent ada5ddc675
commit 8062bd1027

View File

@ -1522,17 +1522,15 @@ class App extends React.Component<AppProps, AppState> {
this.refreshDeviceState(this.excalidrawContainerRef.current); this.refreshDeviceState(this.excalidrawContainerRef.current);
} }
if (prevState.zoom.value !== this.state.zoom.value) { const hasScrollChanged =
this.props?.onScrollAndZoomChange?.({ prevState.scrollX !== this.state.scrollX ||
zoom: this.state.zoom, prevState.scrollY !== this.state.scrollY;
scroll: { x: this.state.scrollX, y: this.state.scrollY },
}); if (hasScrollChanged) {
this.props?.onScrollChange?.(this.state.scrollX, this.state.scrollY);
} }
if ( if (prevState.zoom.value !== this.state.zoom.value || hasScrollChanged) {
prevState.scrollX !== this.state.scrollX ||
prevState.scrollY !== this.state.scrollY
) {
this.props?.onScrollAndZoomChange?.({ this.props?.onScrollAndZoomChange?.({
zoom: this.state.zoom, zoom: this.state.zoom,
scroll: { x: this.state.scrollX, y: this.state.scrollY }, scroll: { x: this.state.scrollX, y: this.state.scrollY },
@ -2414,26 +2412,13 @@ class App extends React.Component<AppProps, AppState> {
) => { ) => {
this.cancelInProgresAnimation?.(); this.cancelInProgresAnimation?.();
// TODO follow-participant // potentially unfollow participant
// seems to work fine but ideally figure out a way to satisfy TS this.setState((prevState, props) => ({
// @ts-ignore ...(typeof state === "function" ? state(prevState, props) : state),
this.setState((prevState, props) => { userToFollow: prevState.shouldDisconnectFollowModeOnCanvasInteraction
if (typeof state === "function") { ? null
return { : prevState.userToFollow,
...state(prevState, props), }));
userToFollow: prevState.shouldDisconnectFollowModeOnCanvasInteraction
? null
: prevState.userToFollow,
};
}
return {
...state,
userToFollow: prevState.shouldDisconnectFollowModeOnCanvasInteraction
? null
: prevState.userToFollow,
};
});
}; };
setToast = ( setToast = (