fix zoom value reset on unmount / mount

This commit is contained in:
KDSBrowne 2022-06-06 20:30:34 +00:00
parent 6d4d11a34d
commit 668be68b8e
3 changed files with 9 additions and 5 deletions

View File

@ -713,6 +713,7 @@ class Presentation extends PureComponent {
fullscreenContext,
layoutContextDispatch,
presentationIsOpen,
slidePosition,
} = this.props;
const { zoom, fitToWidth } = this.state;
@ -732,6 +733,7 @@ class Presentation extends PureComponent {
zoom,
podId,
currentSlide,
slidePosition,
toolbarWidth,
fullscreenElementId,
layoutContextDispatch,

View File

@ -253,6 +253,8 @@ class PresentationToolbar extends PureComponent {
parseCurrentSlideContent,
startPoll,
currentSlide,
slidePosition,
tldrawAPI,
toolbarWidth,
multiUserSize,
multiUser,
@ -378,16 +380,15 @@ class PresentationToolbar extends PureComponent {
{!isMobile ? (
<TooltipContainer>
<ZoomTool
zoomValue={
this.props?.tldrawAPI?.getPageState()?.camera?.zoom
}
slidePosition={slidePosition}
zoomValue={tldrawAPI?.getPageState()?.camera?.zoom}
currentSlideNum={currentSlideNum}
change={this.change}
minBound={0.1}
maxBound={5}
step={STEP}
isMeteorConnected={isMeteorConnected}
tldrawAPI={this.props?.tldrawAPI}
tldrawAPI={tldrawAPI}
/>
</TooltipContainer>
) : null}

View File

@ -147,6 +147,7 @@ class ZoomTool extends PureComponent {
isMeteorConnected,
step,
tldrawAPI,
slidePosition,
} = this.props;
const { stateZoomValue } = this.state;
@ -193,7 +194,7 @@ class ZoomTool extends PureComponent {
aria-describedby="resetZoomDescription"
disabled={(stateZoomValue === minBound) || !isMeteorConnected}
color="default"
customIcon={`${parseInt(this.props?.tldrawAPI?.getPageState()?.camera?.zoom * 100)}%`}
customIcon={`${parseInt(slidePosition?.zoom * 100)}%`}
size="md"
onClick={() => tldrawAPI?.zoomTo(1)}
label={intl.formatMessage(intlMessages.resetZoomLabel)}