mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): fix canvas not filling screen on first load
This commit is contained in:
parent
813f79f0f9
commit
68be95acbb
@ -22,6 +22,7 @@ import { APP_HEIGHT, APP_WIDTH } from 'theme/util/constants';
|
|||||||
import GlobalHotkeys from './GlobalHotkeys';
|
import GlobalHotkeys from './GlobalHotkeys';
|
||||||
import Toaster from './Toaster';
|
import Toaster from './Toaster';
|
||||||
import DeleteImageModal from 'features/gallery/components/DeleteImageModal';
|
import DeleteImageModal from 'features/gallery/components/DeleteImageModal';
|
||||||
|
import { requestCanvasRescale } from 'features/canvas/store/thunks/requestCanvasScale';
|
||||||
|
|
||||||
const DEFAULT_CONFIG = {};
|
const DEFAULT_CONFIG = {};
|
||||||
|
|
||||||
@ -66,10 +67,17 @@ const App = ({
|
|||||||
setIsReady(true);
|
setIsReady(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isApplicationReady) {
|
||||||
|
// TODO: This is a jank fix for canvas not filling the screen on first load
|
||||||
|
setTimeout(() => {
|
||||||
|
dispatch(requestCanvasRescale());
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
setIsReady && setIsReady(false);
|
setIsReady && setIsReady(false);
|
||||||
};
|
};
|
||||||
}, [isApplicationReady, setIsReady]);
|
}, [dispatch, isApplicationReady, setIsReady]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -30,7 +30,10 @@ import {
|
|||||||
} from './canvasTypes';
|
} from './canvasTypes';
|
||||||
import { ImageDTO } from 'services/api';
|
import { ImageDTO } from 'services/api';
|
||||||
import { sessionCanceled } from 'services/thunks/session';
|
import { sessionCanceled } from 'services/thunks/session';
|
||||||
import { setShouldUseCanvasBetaLayout } from 'features/ui/store/uiSlice';
|
import {
|
||||||
|
setActiveTab,
|
||||||
|
setShouldUseCanvasBetaLayout,
|
||||||
|
} from 'features/ui/store/uiSlice';
|
||||||
import { imageUrlsReceived } from 'services/thunks/image';
|
import { imageUrlsReceived } from 'services/thunks/image';
|
||||||
|
|
||||||
export const initialLayerState: CanvasLayerState = {
|
export const initialLayerState: CanvasLayerState = {
|
||||||
@ -857,6 +860,11 @@ export const canvasSlice = createSlice({
|
|||||||
builder.addCase(setShouldUseCanvasBetaLayout, (state, action) => {
|
builder.addCase(setShouldUseCanvasBetaLayout, (state, action) => {
|
||||||
state.doesCanvasNeedScaling = true;
|
state.doesCanvasNeedScaling = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
builder.addCase(setActiveTab, (state, action) => {
|
||||||
|
state.doesCanvasNeedScaling = true;
|
||||||
|
});
|
||||||
|
|
||||||
builder.addCase(imageUrlsReceived.fulfilled, (state, action) => {
|
builder.addCase(imageUrlsReceived.fulfilled, (state, action) => {
|
||||||
const { image_name, image_origin, image_url, thumbnail_url } =
|
const { image_name, image_origin, image_url, thumbnail_url } =
|
||||||
action.payload;
|
action.payload;
|
||||||
|
@ -55,8 +55,6 @@ const UnifiedCanvasContent = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
dispatch(requestCanvasRescale());
|
|
||||||
|
|
||||||
const resizeCallback = () => {
|
const resizeCallback = () => {
|
||||||
dispatch(requestCanvasRescale());
|
dispatch(requestCanvasRescale());
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user