diff --git a/src/constants/coreSettings.ts b/src/constants/coreSettings.ts index 8800b0086..3b77870f5 100644 --- a/src/constants/coreSettings.ts +++ b/src/constants/coreSettings.ts @@ -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' } ] diff --git a/src/locales/en.json b/src/locales/en.json index 846e893b9..c57193099 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -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" }, diff --git a/src/locales/ja.json b/src/locales/ja.json index 9d1fb49ed..cf2e18633 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -188,6 +188,9 @@ "Comfy_EnableTooltips": { "name": "ツールチップを有効にする" }, + "Comfy_EnableWorkflowViewRestore": { + "name": "ワークフロー内のキャンバスの位置とズームレベルを保存および復元する" + }, "Comfy_Extension_Disabled": { "name": "無効な拡張機能名" }, diff --git a/src/locales/ru.json b/src/locales/ru.json index b793e527e..96112686c 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -188,6 +188,9 @@ "Comfy_EnableTooltips": { "name": "Включить подсказки" }, + "Comfy_EnableWorkflowViewRestore": { + "name": "Сохранять и восстанавливать положение и уровень масштабирования холста в рабочих процессах" + }, "Comfy_Extension_Disabled": { "name": "Отключенные имена расширений" }, diff --git a/src/locales/zh.json b/src/locales/zh.json index 5bf63ead3..4de02633e 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -188,6 +188,9 @@ "Comfy_EnableTooltips": { "name": "启用工具提示" }, + "Comfy_EnableWorkflowViewRestore": { + "name": "在工作流中保存和恢复画布位置及缩放级别" + }, "Comfy_Extension_Disabled": { "name": "禁用的扩展名称" }, diff --git a/src/scripts/app.ts b/src/scripts/app.ts index a400055cd..e6df7b133 100644 --- a/src/scripts/app.ts +++ b/src/scripts/app.ts @@ -131,7 +131,6 @@ export class ComfyApp { _nodeOutputs: Record nodePreviewImages: Record 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