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"""
|
||||
|
||||
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)")
|
||||
height: int = InputField(default=512, ge=64, multiple_of=8, description="The height to resize to (px)")
|
||||
width: int = InputField(default=512, gt=0, description="The width 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")
|
||||
metadata: Optional[CoreMetadata] = InputField(
|
||||
default=None, description=FieldDescriptions.core_metadata, ui_hidden=True
|
||||
|
@ -154,6 +154,8 @@ const IAICanvas = () => {
|
||||
|
||||
resizeObserver.observe(containerRef.current);
|
||||
|
||||
dispatch(canvasResized(containerRef.current.getBoundingClientRect()));
|
||||
|
||||
return () => {
|
||||
resizeObserver.disconnect();
|
||||
};
|
||||
|
@ -8,7 +8,7 @@ const calculateScale = (
|
||||
const scaleX = (containerWidth * padding) / contentWidth;
|
||||
const scaleY = (containerHeight * padding) / contentHeight;
|
||||
const scaleFit = Math.min(1, Math.min(scaleX, scaleY));
|
||||
return scaleFit;
|
||||
return scaleFit ? scaleFit : 1;
|
||||
};
|
||||
|
||||
export default calculateScale;
|
||||
|
@ -37,6 +37,7 @@ import {
|
||||
import { ImageDTO } from 'services/api/types';
|
||||
import { configSelector } from '../../../system/store/configSelectors';
|
||||
import { sentImageToCanvas, sentImageToImg2Img } from '../../store/actions';
|
||||
import { flushSync } from 'react-dom';
|
||||
|
||||
type SingleSelectionMenuItemsProps = {
|
||||
imageDTO: ImageDTO;
|
||||
@ -115,8 +116,10 @@ const SingleSelectionMenuItems = (props: SingleSelectionMenuItemsProps) => {
|
||||
|
||||
const handleSendToCanvas = useCallback(() => {
|
||||
dispatch(sentImageToCanvas());
|
||||
flushSync(() => {
|
||||
dispatch(setActiveTab('unifiedCanvas'));
|
||||
});
|
||||
dispatch(setInitialCanvasImage(imageDTO));
|
||||
dispatch(setActiveTab('unifiedCanvas'));
|
||||
|
||||
toaster({
|
||||
title: t('toast.sentToUnifiedCanvas'),
|
||||
|
Loading…
Reference in New Issue
Block a user