mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-25 08:49:36 +00:00
Add toggle link visibility button on canvas menu (#1070)
* Basic link visibility toggle * Icon change * nit * Update litegraph * nit * Add playwright test * Update test expectations [skip ci] --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import { useSettingStore } from '@/stores/settingStore'
|
||||
import { useToastStore } from '@/stores/toastStore'
|
||||
import { showTemplateWorkflowsDialog } from '@/services/dialogService'
|
||||
import { useQueueStore } from './queueStore'
|
||||
import { LiteGraph } from '@comfyorg/litegraph'
|
||||
|
||||
export interface ComfyCommand {
|
||||
id: string
|
||||
@@ -15,7 +16,7 @@ export interface ComfyCommand {
|
||||
label?: string | (() => string)
|
||||
icon?: string | (() => string)
|
||||
tooltip?: string | (() => string)
|
||||
shortcut?: string
|
||||
versionAdded?: string
|
||||
}
|
||||
|
||||
const getTracker = () =>
|
||||
@@ -206,6 +207,29 @@ export const useCommandStore = defineStore('command', () => {
|
||||
function: () => {
|
||||
app.canvas['read_only'] = !app.canvas['read_only']
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'Comfy.Canvas.ToggleLinkVisibility',
|
||||
icon: 'pi pi-eye',
|
||||
label: 'Toggle Link Visibility',
|
||||
versionAdded: '1.3.6',
|
||||
|
||||
function: (() => {
|
||||
let lastLinksRenderMode = LiteGraph.SPLINE_LINK
|
||||
|
||||
return () => {
|
||||
const currentMode = settingStore.get('Comfy.LinkRenderMode')
|
||||
|
||||
if (currentMode === LiteGraph.HIDDEN_LINK) {
|
||||
// If links are hidden, restore the last positive value or default to spline mode
|
||||
settingStore.set('Comfy.LinkRenderMode', lastLinksRenderMode)
|
||||
} else {
|
||||
// If links are visible, store the current mode and hide links
|
||||
lastLinksRenderMode = currentMode
|
||||
settingStore.set('Comfy.LinkRenderMode', LiteGraph.HIDDEN_LINK)
|
||||
}
|
||||
}
|
||||
})()
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user