Fixes canvas failing to scale on first run

This commit is contained in:
psychedelicious 2022-11-25 08:22:19 +11:00 committed by blessedcoolant
parent f5e8ffe7b4
commit a3a0a87f55

View File

@ -3,6 +3,7 @@ import { useLayoutEffect, useRef } from 'react';
import { useAppDispatch, useAppSelector } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/store';
import { activeTabNameSelector } from 'features/options/store/optionsSelectors'; import { activeTabNameSelector } from 'features/options/store/optionsSelectors';
import { import {
resizeAndScaleCanvas,
resizeCanvas, resizeCanvas,
setCanvasContainerDimensions, setCanvasContainerDimensions,
setDoesCanvasNeedScaling, setDoesCanvasNeedScaling,
@ -52,7 +53,11 @@ const IAICanvasResizer = () => {
}) })
); );
dispatch(resizeCanvas()); if (!isCanvasInitialized) {
dispatch(resizeAndScaleCanvas());
} else {
dispatch(resizeCanvas());
}
dispatch(setDoesCanvasNeedScaling(false)); dispatch(setDoesCanvasNeedScaling(false));
}, 0); }, 0);