mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-02 12:11: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:
@@ -5194,10 +5194,9 @@ export class LGraphCanvas
|
||||
const color = node.renderingColor
|
||||
const bgcolor = node.renderingBgColor
|
||||
|
||||
const { low_quality, editor_alpha } = this
|
||||
ctx.globalAlpha = editor_alpha
|
||||
ctx.globalAlpha = this.getNodeModeAlpha(node)
|
||||
|
||||
if (this.render_shadows && !low_quality) {
|
||||
if (this.render_shadows && !this.low_quality) {
|
||||
ctx.shadowColor = LiteGraph.DEFAULT_SHADOW_COLOR
|
||||
ctx.shadowOffsetX = 2 * this.ds.scale
|
||||
ctx.shadowOffsetY = 2 * this.ds.scale
|
||||
@@ -5259,7 +5258,7 @@ export class LGraphCanvas
|
||||
}
|
||||
}
|
||||
|
||||
if (!low_quality) {
|
||||
if (!this.low_quality) {
|
||||
node.drawBadges(ctx)
|
||||
}
|
||||
|
||||
@@ -5693,6 +5692,14 @@ export class LGraphCanvas
|
||||
ctx.globalAlpha = 1
|
||||
}
|
||||
|
||||
private getNodeModeAlpha(node: LGraphNode) {
|
||||
return node.mode === LGraphEventMode.BYPASS
|
||||
? 0.2
|
||||
: node.mode === LGraphEventMode.NEVER
|
||||
? 0.4
|
||||
: this.editor_alpha
|
||||
}
|
||||
|
||||
#renderFloatingLinks(
|
||||
ctx: CanvasRenderingContext2D,
|
||||
graph: LGraph,
|
||||
@@ -6044,7 +6051,7 @@ export class LGraphCanvas
|
||||
): void {
|
||||
node.drawWidgets(ctx, {
|
||||
lowQuality: this.low_quality,
|
||||
editorAlpha: this.editor_alpha
|
||||
editorAlpha: this.getNodeModeAlpha(node)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user