stop zoom out at min %

This commit is contained in:
KDSBrowne 2022-06-13 15:39:34 +00:00
parent c707f02b48
commit 15e58c0f69

View File

@ -53,10 +53,15 @@ class ZoomTool extends PureComponent {
}
componentDidUpdate() {
const { zoomValue } = this.props;
const { zoomValue, tldrawAPI } = this.props;
const { stateZoomValue } = this.state;
const isDifferent = zoomValue !== stateZoomValue;
if (isDifferent) this.onChanger(zoomValue);
if (isDifferent) {
this.onChanger(zoomValue);
if (tldrawAPI && zoomValue === 1 && tldrawAPI?.getPageState()?.camera?.zoom === 1) {
tldrawAPI?.zoomToFit();
}
}
}
onChanger(value) {