Move Comfy.EnableWorkflowViewRestore to coreSettings (#1767)

This commit is contained in:
Chenlei Hu
2024-12-02 14:50:46 -08:00
committed by GitHub
parent d1279fa474
commit c1f0cfe366
6 changed files with 22 additions and 10 deletions

View File

@@ -650,5 +650,13 @@ export const CORE_SETTINGS: SettingParams[] = [
},
defaultValue: 0,
versionAdded: '1.5.1'
},
{
id: 'Comfy.EnableWorkflowViewRestore',
category: ['Comfy', 'Workflow', 'EnableWorkflowViewRestore'],
name: 'Save and restore canvas position and zoom level in workflows',
type: 'boolean',
defaultValue: true,
versionModified: '1.5.4'
}
]

View File

@@ -154,6 +154,9 @@
"Comfy_EnableTooltips": {
"name": "Enable Tooltips"
},
"Comfy_EnableWorkflowViewRestore": {
"name": "Save and restore canvas position and zoom level in workflows"
},
"Comfy_Extension_Disabled": {
"name": "Disabled extension names"
},

View File

@@ -188,6 +188,9 @@
"Comfy_EnableTooltips": {
"name": "ツールチップを有効にする"
},
"Comfy_EnableWorkflowViewRestore": {
"name": "ワークフロー内のキャンバスの位置とズームレベルを保存および復元する"
},
"Comfy_Extension_Disabled": {
"name": "無効な拡張機能名"
},

View File

@@ -188,6 +188,9 @@
"Comfy_EnableTooltips": {
"name": "Включить подсказки"
},
"Comfy_EnableWorkflowViewRestore": {
"name": "Сохранять и восстанавливать положение и уровень масштабирования холста в рабочих процессах"
},
"Comfy_Extension_Disabled": {
"name": "Отключенные имена расширений"
},

View File

@@ -188,6 +188,9 @@
"Comfy_EnableTooltips": {
"name": "启用工具提示"
},
"Comfy_EnableWorkflowViewRestore": {
"name": "在工作流中保存和恢复画布位置及缩放级别"
},
"Comfy_Extension_Disabled": {
"name": "禁用的扩展名称"
},

View File

@@ -131,7 +131,6 @@ export class ComfyApp {
_nodeOutputs: Record<string, any>
nodePreviewImages: Record<string, typeof Image>
graph: LGraph
enableWorkflowViewRestore: any
canvas: LGraphCanvas
dragOverNode: LGraphNode | null
canvasEl: HTMLCanvasElement
@@ -464,7 +463,7 @@ export class ComfyApp {
const workflow = serialize.apply(this, arguments)
// Store the drag & scale info in the serialized workflow if the setting is enabled
if (self.enableWorkflowViewRestore.value) {
if (useSettingStore().get('Comfy.EnableWorkflowViewRestore')) {
if (!workflow.extra) {
workflow.extra = {}
}
@@ -479,13 +478,6 @@ export class ComfyApp {
return workflow
}
this.enableWorkflowViewRestore = this.ui.settings.addSetting({
id: 'Comfy.EnableWorkflowViewRestore',
category: ['Comfy', 'Workflow', 'EnableWorkflowViewRestore'],
name: 'Save and restore canvas position and zoom level in workflows',
type: 'boolean',
defaultValue: true
})
}
/**
@@ -2168,7 +2160,7 @@ export class ComfyApp {
this.graph.configure(graphData)
if (
restore_view &&
this.enableWorkflowViewRestore.value &&
useSettingStore().get('Comfy.EnableWorkflowViewRestore') &&
graphData.extra?.ds
) {
// @ts-expect-error