[backport core/1.35] Add support for NO_TITLE in vue, disabling border (#7686)

Backport of #7589 to `core/1.35`

Automatically created by backport workflow.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-7686-backport-core-1-35-Add-support-for-NO_TITLE-in-vue-disabling-border-2cf6d73d3650815a88c7ce39cff56b90)
by [Unito](https://www.unito.io)

Co-authored-by: AustinMroz <austin@comfy.org>
This commit is contained in:
Comfy Org PR Bot
2025-12-21 06:55:44 +09:00
committed by GitHub
parent 884f0a73c0
commit ce18d4dfc6
3 changed files with 39 additions and 13 deletions

View File

@@ -31,8 +31,9 @@ import type {
LGraphTriggerAction,
LGraphTriggerEvent,
LGraphTriggerParam
} from '../../lib/litegraph/src/litegraph'
import { NodeSlotType } from '../../lib/litegraph/src/types/globalEnums'
} from '@/lib/litegraph/src/litegraph'
import type { TitleMode } from '@/lib/litegraph/src/types/globalEnums'
import { NodeSlotType } from '@/lib/litegraph/src/types/globalEnums'
export interface WidgetSlotMetadata {
index: number
@@ -55,26 +56,27 @@ export interface SafeWidgetData {
}
export interface VueNodeData {
executing: boolean
id: NodeId
title: string
type: string
mode: number
selected: boolean
executing: boolean
title: string
type: string
apiNode?: boolean
badges?: (LGraphBadge | (() => LGraphBadge))[]
subgraphId?: string | null
widgets?: SafeWidgetData[]
inputs?: INodeInputSlot[]
outputs?: INodeOutputSlot[]
hasErrors?: boolean
bgcolor?: string
color?: string
flags?: {
collapsed?: boolean
pinned?: boolean
}
color?: string
bgcolor?: string
hasErrors?: boolean
inputs?: INodeInputSlot[]
outputs?: INodeOutputSlot[]
shape?: number
subgraphId?: string | null
titleMode?: TitleMode
widgets?: SafeWidgetData[]
}
export interface GraphNodeManager {
@@ -262,6 +264,7 @@ export function useGraphNodeManager(graph: LGraph): GraphNodeManager {
title: typeof node.title === 'string' ? node.title : '',
type: nodeType,
mode: node.mode || 0,
titleMode: node.title_mode,
selected: node.selected || false,
executing: false, // Will be updated separately based on execution state
subgraphId,

View File

@@ -51,7 +51,10 @@
@dragleave="handleDragLeave"
@drop.stop.prevent="handleDrop"
>
<div class="flex flex-col justify-center items-center relative">
<div
v-if="displayHeader"
class="flex flex-col justify-center items-center relative"
>
<template v-if="isCollapsed">
<SlotConnectionDot
v-if="hasInputs"
@@ -145,6 +148,7 @@ import {
LiteGraph,
RenderShape
} from '@/lib/litegraph/src/litegraph'
import { TitleMode } from '@/lib/litegraph/src/types/globalEnums'
import { useSettingStore } from '@/platform/settings/settingStore'
import { useTelemetry } from '@/platform/telemetry'
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
@@ -165,6 +169,7 @@ import { app } from '@/scripts/app'
import { useExecutionStore } from '@/stores/executionStore'
import { useNodeOutputStore } from '@/stores/imagePreviewStore'
import { useColorPaletteStore } from '@/stores/workspace/colorPaletteStore'
import { isTransparent } from '@/utils/colorUtil'
import {
getLocatorIdFromNodeData,
getNodeByLocatorId
@@ -215,6 +220,8 @@ const hasAnyError = computed((): boolean => {
)
})
const displayHeader = computed(() => nodeData.titleMode !== TitleMode.NO_TITLE)
const isCollapsed = computed(() => nodeData.flags?.collapsed ?? false)
const bypassed = computed(
(): boolean => nodeData.mode === LGraphEventMode.BYPASS
@@ -370,6 +377,13 @@ const { latestPreviewUrl, shouldShowPreviewImg } = useNodePreviewState(
const borderClass = computed(() => {
if (hasAnyError.value) return 'border-node-stroke-error'
//FIXME need a better way to detecting transparency
if (
!displayHeader.value &&
nodeData.bgcolor &&
isTransparent(nodeData.bgcolor)
)
return 'border-0'
return ''
})

View File

@@ -21,6 +21,15 @@ export interface ColorAdjustOptions {
opacity?: number
}
export function isTransparent(color: string) {
if (color === 'transparent') return true
if (color[0] === '#') {
if (color.length === 5) return color[4] === '0'
if (color.length === 9) return color.substring(7) === '00'
}
return false
}
function rgbToHsl({ r, g, b }: RGB): HSL {
r /= 255
g /= 255