This commit is contained in:
Qing
2024-01-03 09:03:04 +08:00
parent aca85543ca
commit 9df94489e1
7 changed files with 26 additions and 17 deletions

View File

@@ -66,6 +66,7 @@ const Cropper = (props: Props) => {
imageWidth,
imageHeight,
isInpainting,
isSD,
{ x, y, width, height },
setX,
setY,
@@ -77,6 +78,7 @@ const Cropper = (props: Props) => {
state.imageWidth,
state.imageHeight,
state.isInpainting,
state.isSD(),
state.cropperState,
state.setCropperX,
state.setCropperY,
@@ -377,7 +379,7 @@ const Cropper = (props: Props) => {
)
}
if (show === false) {
if (show === false || !isSD) {
return null
}

View File

@@ -2,7 +2,6 @@ import * as React from "react"
import io from "socket.io-client"
import { Progress } from "./ui/progress"
import { useStore } from "@/lib/states"
import { MODEL_TYPE_INPAINT } from "@/lib/const"
export const API_ENDPOINT = import.meta.env.VITE_BACKEND
? import.meta.env.VITE_BACKEND
@@ -10,16 +9,16 @@ export const API_ENDPOINT = import.meta.env.VITE_BACKEND
const socket = io(API_ENDPOINT)
const DiffusionProgress = () => {
const [settings, isInpainting] = useStore((state) => [
const [settings, isInpainting, isSD] = useStore((state) => [
state.settings,
state.isInpainting,
state.isSD(),
])
const [isConnected, setIsConnected] = React.useState(false)
const [step, setStep] = React.useState(0)
const progress = Math.min(Math.round((step / settings.sdSteps) * 100), 100)
const isSD = settings.model.model_type !== MODEL_TYPE_INPAINT
React.useEffect(() => {
if (!isSD) {

View File

@@ -604,7 +604,7 @@ export default function Editor(props: EditorProps) {
)
useHotKey(
"ctrl+c, cmd+c",
"ctrl+c,meta+c",
async () => {
const hasPermission = await askWritePermission()
if (hasPermission && renders.length > 0) {

View File

@@ -48,6 +48,7 @@ const Extender = (props: Props) => {
isInpainting,
imageHeight,
imageWdith,
isSD,
{ x, y, width, height },
setX,
setY,
@@ -60,6 +61,7 @@ const Extender = (props: Props) => {
state.isInpainting,
state.imageHeight,
state.imageWidth,
state.isSD(),
state.extenderState,
state.setExtenderX,
state.setExtenderY,
@@ -391,7 +393,7 @@ const Extender = (props: Props) => {
)
}
if (show === false) {
if (show === false || !isSD) {
return null
}

View File

@@ -161,6 +161,8 @@ type AppAction = {
getBrushSize: () => number
setImageSize: (width: number, height: number) => void
isSD: () => boolean
setCropperX: (newValue: number) => void
setCropperY: (newValue: number) => void
setCropperWidth: (newValue: number) => void
@@ -170,6 +172,7 @@ type AppAction = {
setExtenderY: (newValue: number) => void
setExtenderWidth: (newValue: number) => void
setExtenderHeight: (newValue: number) => void
setIsCropperExtenderResizing: (newValue: boolean) => void
updateExtenderDirection: (newValue: ExtenderDirection) => void
resetExtender: (width: number, height: number) => void
@@ -618,6 +621,10 @@ export const useStore = createWithEqualityFn<AppState & AppAction>()(
return get().isInpainting || get().isPluginRunning
},
isSD: (): boolean => {
return get().settings.model.model_type !== MODEL_TYPE_INPAINT
},
// undo/redo
undoDisabled: (): boolean => {