mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-06 02:00:46 +00:00
Clear edit mode when model doesn't support mask
This commit is contained in:
1 parent
7671fc38fb
commit
53493bbf47
2 files changed
+15
-3
No files matched your search
@@ -20,7 +20,7 @@ import {
|
||||
ModelSelector,
|
||||
useModelSelectorStore,
|
||||
} from "@storyteller/ui-model-selector";
|
||||
import { getModelByLabel, lookupModelByTauriId, ModelInfo } from "@storyteller/model-list";
|
||||
import { lookupModelByTauriId, ModelInfo } from "@storyteller/model-list";
|
||||
import { useImageEditCompleteEvent } from "@storyteller/tauri-events";
|
||||
import { HistoryStack, ImageBundle } from "./HistoryStack";
|
||||
import { ModelTag } from "libs/model-list/src/lib/ModelTag";
|
||||
@@ -265,7 +265,12 @@ const PageEdit = () => {
|
||||
|
||||
const modelConfig = lookupModelByTauriId(selectedModelInfo!.tauri_id);
|
||||
const supportsMaskedInpainting = modelConfig?.tags?.includes(ModelTag.MaskedInpainting) ?? false;
|
||||
console.log("Model supports instructive edit:", supportsMaskedInpainting);
|
||||
|
||||
if (!supportsMaskedInpainting && (store.activeTool !== "select" || store.lineNodes.length > 0)) {
|
||||
// TODO: Implement a new mode for unsupported masking and hide the nodes layer instead of clearing
|
||||
store.setActiveTool("select");
|
||||
store.clearLineNodes();
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
|
||||
@@ -810,7 +810,14 @@ export const useEditStore = create<EditState>((set, get, store) => ({
|
||||
},
|
||||
|
||||
// Toolbar actions
|
||||
setActiveTool: (tool: ActiveEditTool) => set({ activeTool: tool }),
|
||||
setActiveTool: (tool: ActiveEditTool) => {
|
||||
// Avoid triggering state change if the tool is same
|
||||
if (tool === get().activeTool) {
|
||||
return;
|
||||
}
|
||||
|
||||
set({ activeTool: tool })
|
||||
},
|
||||
setEditOperation: (mode: EditOperation) => set({ editOperation: mode }),
|
||||
setBrushColor: (color: string) => set({ brushColor: color }),
|
||||
setBrushSize: (size: number) => set({ brushSize: size }),
|
||||
|
||||
Reference in new issue
Block a user