mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Merge branch 'main' into moretranslation
This commit is contained in:
commit
a1ef079d1f
@ -335,8 +335,8 @@ class ImageResizeInvocation(BaseInvocation):
|
|||||||
"""Resizes an image to specific dimensions"""
|
"""Resizes an image to specific dimensions"""
|
||||||
|
|
||||||
image: ImageField = InputField(description="The image to resize")
|
image: ImageField = InputField(description="The image to resize")
|
||||||
width: int = InputField(default=512, ge=64, multiple_of=8, description="The width to resize to (px)")
|
width: int = InputField(default=512, gt=0, description="The width to resize to (px)")
|
||||||
height: int = InputField(default=512, ge=64, multiple_of=8, description="The height to resize to (px)")
|
height: int = InputField(default=512, gt=0, description="The height to resize to (px)")
|
||||||
resample_mode: PIL_RESAMPLING_MODES = InputField(default="bicubic", description="The resampling mode")
|
resample_mode: PIL_RESAMPLING_MODES = InputField(default="bicubic", description="The resampling mode")
|
||||||
metadata: Optional[CoreMetadata] = InputField(
|
metadata: Optional[CoreMetadata] = InputField(
|
||||||
default=None, description=FieldDescriptions.core_metadata, ui_hidden=True
|
default=None, description=FieldDescriptions.core_metadata, ui_hidden=True
|
||||||
|
@ -154,6 +154,8 @@ const IAICanvas = () => {
|
|||||||
|
|
||||||
resizeObserver.observe(containerRef.current);
|
resizeObserver.observe(containerRef.current);
|
||||||
|
|
||||||
|
dispatch(canvasResized(containerRef.current.getBoundingClientRect()));
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
resizeObserver.disconnect();
|
resizeObserver.disconnect();
|
||||||
};
|
};
|
||||||
|
@ -8,7 +8,7 @@ const calculateScale = (
|
|||||||
const scaleX = (containerWidth * padding) / contentWidth;
|
const scaleX = (containerWidth * padding) / contentWidth;
|
||||||
const scaleY = (containerHeight * padding) / contentHeight;
|
const scaleY = (containerHeight * padding) / contentHeight;
|
||||||
const scaleFit = Math.min(1, Math.min(scaleX, scaleY));
|
const scaleFit = Math.min(1, Math.min(scaleX, scaleY));
|
||||||
return scaleFit;
|
return scaleFit ? scaleFit : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default calculateScale;
|
export default calculateScale;
|
||||||
|
@ -37,6 +37,7 @@ import {
|
|||||||
import { ImageDTO } from 'services/api/types';
|
import { ImageDTO } from 'services/api/types';
|
||||||
import { configSelector } from '../../../system/store/configSelectors';
|
import { configSelector } from '../../../system/store/configSelectors';
|
||||||
import { sentImageToCanvas, sentImageToImg2Img } from '../../store/actions';
|
import { sentImageToCanvas, sentImageToImg2Img } from '../../store/actions';
|
||||||
|
import { flushSync } from 'react-dom';
|
||||||
|
|
||||||
type SingleSelectionMenuItemsProps = {
|
type SingleSelectionMenuItemsProps = {
|
||||||
imageDTO: ImageDTO;
|
imageDTO: ImageDTO;
|
||||||
@ -115,8 +116,10 @@ const SingleSelectionMenuItems = (props: SingleSelectionMenuItemsProps) => {
|
|||||||
|
|
||||||
const handleSendToCanvas = useCallback(() => {
|
const handleSendToCanvas = useCallback(() => {
|
||||||
dispatch(sentImageToCanvas());
|
dispatch(sentImageToCanvas());
|
||||||
|
flushSync(() => {
|
||||||
|
dispatch(setActiveTab('unifiedCanvas'));
|
||||||
|
});
|
||||||
dispatch(setInitialCanvasImage(imageDTO));
|
dispatch(setInitialCanvasImage(imageDTO));
|
||||||
dispatch(setActiveTab('unifiedCanvas'));
|
|
||||||
|
|
||||||
toaster({
|
toaster({
|
||||||
title: t('toast.sentToUnifiedCanvas'),
|
title: t('toast.sentToUnifiedCanvas'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user