mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Fixes canvas dimensions not setting on first load
This commit is contained in:
parent
b0697bc4ff
commit
3131edb255
@ -28,9 +28,11 @@ import { socketioMiddleware } from './socketio/middleware';
|
||||
* The necesssary nested persistors with blacklists are configured below.
|
||||
*/
|
||||
|
||||
const canvasBlacklist = ['cursorPosition'].map(
|
||||
(blacklistItem) => `canvas.${blacklistItem}`
|
||||
);
|
||||
const canvasBlacklist = [
|
||||
'cursorPosition',
|
||||
'isCanvasInitialized',
|
||||
'doesCanvasNeedScaling',
|
||||
].map((blacklistItem) => `canvas.${blacklistItem}`);
|
||||
|
||||
const systemBlacklist = [
|
||||
'currentIteration',
|
||||
|
@ -503,6 +503,7 @@ export const canvasSlice = createSlice({
|
||||
|
||||
state.stageScale = newScale;
|
||||
state.stageCoordinates = newCoordinates;
|
||||
state.stageDimensions = newStageDimensions;
|
||||
state.boundingBoxCoordinates = { x: 0, y: 0 };
|
||||
state.boundingBoxDimensions = { width: 512, height: 512 };
|
||||
return;
|
||||
|
@ -16,7 +16,6 @@ import {
|
||||
import ImageToImageWorkarea from './ImageToImage';
|
||||
import TextToImageWorkarea from './TextToImage';
|
||||
import Lightbox from 'features/lightbox/components/Lightbox';
|
||||
import { setDoesCanvasNeedScaling } from 'features/canvas/store/canvasSlice';
|
||||
import UnifiedCanvasWorkarea from './UnifiedCanvas/UnifiedCanvasWorkarea';
|
||||
import UnifiedCanvasIcon from 'common/icons/UnifiedCanvasIcon';
|
||||
import TrainingWIP from 'common/components/WorkInProgress/Training';
|
||||
@ -143,7 +142,6 @@ export default function InvokeTabs() {
|
||||
index={activeTab}
|
||||
onChange={(index: number) => {
|
||||
dispatch(setActiveTab(index));
|
||||
dispatch(setDoesCanvasNeedScaling(true));
|
||||
}}
|
||||
>
|
||||
<div className="app-tabs-list">{renderTabs()}</div>
|
||||
|
@ -26,13 +26,18 @@ const selector = createSelector(
|
||||
|
||||
const UnifiedCanvasDisplay = () => {
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const { doesCanvasNeedScaling } = useAppSelector(selector);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
dispatch(setDoesCanvasNeedScaling(true));
|
||||
|
||||
const resizeCallback = _.debounce(() => {
|
||||
dispatch(setDoesCanvasNeedScaling(true));
|
||||
}, 250);
|
||||
|
||||
window.addEventListener('resize', resizeCallback);
|
||||
|
||||
return () => window.removeEventListener('resize', resizeCallback);
|
||||
}, [dispatch]);
|
||||
|
||||
|
@ -1,15 +1,8 @@
|
||||
import UnifiedCanvasPanel from './UnifiedCanvasPanel';
|
||||
import UnifiedCanvasDisplay from './UnifiedCanvasDisplay';
|
||||
import InvokeWorkarea from 'features/tabs/components/InvokeWorkarea';
|
||||
import { useAppDispatch } from 'app/store';
|
||||
import { useEffect } from 'react';
|
||||
import { setDoesCanvasNeedScaling } from 'features/canvas/store/canvasSlice';
|
||||
|
||||
export default function UnifiedCanvasWorkarea() {
|
||||
const dispatch = useAppDispatch();
|
||||
useEffect(() => {
|
||||
dispatch(setDoesCanvasNeedScaling(true));
|
||||
}, [dispatch]);
|
||||
return (
|
||||
<InvokeWorkarea
|
||||
optionsPanel={<UnifiedCanvasPanel />}
|
||||
|
Loading…
Reference in New Issue
Block a user