mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-03 04:31:58 +00:00
Cleanup: Removing monkeypatches for litegraph logic (#5902)
## Summary Putting the litegraph specific pieces into litegraph itself, using the CanvasGraph and LiteGraphGlobal to coordinate options. This was one part of the Image Previews reloading/calculating with every canvas draw. ## Review Focus Is this keeping things decoupled enough? Is this the right place to put things? Are there assumptions about the options that I'm missing here? ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5902-WIP-Removing-monkeypatches-for-litegraph-logic-2816d73d3650818b860ec73579b89b54) by [Unito](https://www.unito.io) --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
} from '@/renderer/core/canvas/litegraph/slotCalculations'
|
||||
import { useLayoutMutations } from '@/renderer/core/layout/operations/layoutMutations'
|
||||
import { LayoutSource } from '@/renderer/core/layout/types'
|
||||
import { type ColorAdjustOptions, adjustColor } from '@/utils/colorUtil'
|
||||
|
||||
import type { DragAndScale } from './DragAndScale'
|
||||
import type { LGraph } from './LGraph'
|
||||
@@ -302,13 +303,25 @@ export class LGraphNode
|
||||
|
||||
/** The fg color used to render the node. */
|
||||
get renderingColor(): string {
|
||||
return this.color || this.constructor.color || LiteGraph.NODE_DEFAULT_COLOR
|
||||
const baseColor =
|
||||
this.color || this.constructor.color || LiteGraph.NODE_DEFAULT_COLOR
|
||||
return adjustColor(baseColor, { lightness: LiteGraph.nodeLightness })
|
||||
}
|
||||
|
||||
/** The bg color used to render the node. */
|
||||
get renderingBgColor(): string {
|
||||
return (
|
||||
const baseBgColor =
|
||||
this.bgcolor || this.constructor.bgcolor || LiteGraph.NODE_DEFAULT_BGCOLOR
|
||||
const adjustments: ColorAdjustOptions = {
|
||||
opacity: LiteGraph.nodeOpacity,
|
||||
lightness: LiteGraph.nodeLightness
|
||||
}
|
||||
|
||||
return adjustColor(
|
||||
this.mode === LGraphEventMode.BYPASS
|
||||
? LiteGraph.NODE_DEFAULT_BYPASS_COLOR
|
||||
: baseBgColor,
|
||||
adjustments
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user