mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-03 12:10:11 +00:00
[nit] Move labelPosition to NodeSlot.draw (#497)
This commit is contained in:
@@ -57,7 +57,7 @@ import {
|
||||
isInRect,
|
||||
snapPoint,
|
||||
} from "./measure"
|
||||
import { LabelPosition, strokeShape } from "./draw"
|
||||
import { strokeShape } from "./draw"
|
||||
import { DragAndScale } from "./DragAndScale"
|
||||
import { LinkReleaseContextExtended, LiteGraph } from "./litegraph"
|
||||
import { stringOrEmpty, stringOrNull } from "./strings"
|
||||
@@ -4736,7 +4736,6 @@ export class LGraphCanvas implements ConnectionColorContext {
|
||||
pos,
|
||||
colorContext: this,
|
||||
labelColor: label_color,
|
||||
labelPosition: LabelPosition.Right,
|
||||
horizontal,
|
||||
lowQuality: low_quality,
|
||||
renderText: render_text,
|
||||
@@ -4771,7 +4770,6 @@ export class LGraphCanvas implements ConnectionColorContext {
|
||||
pos,
|
||||
colorContext: this,
|
||||
labelColor: label_color,
|
||||
labelPosition: LabelPosition.Left,
|
||||
horizontal,
|
||||
lowQuality: low_quality,
|
||||
renderText: render_text,
|
||||
|
||||
@@ -200,12 +200,13 @@ export class NodeInputSlot extends NodeSlot implements INodeInputSlot {
|
||||
return this.link != null
|
||||
}
|
||||
|
||||
override draw(ctx: CanvasRenderingContext2D, options: Omit<IDrawOptions, "doStroke">) {
|
||||
override draw(ctx: CanvasRenderingContext2D, options: Omit<IDrawOptions, "doStroke" | "labelPosition">) {
|
||||
const originalTextAlign = ctx.textAlign
|
||||
ctx.textAlign = options.horizontal ? "center" : "left"
|
||||
|
||||
super.draw(ctx, {
|
||||
...options,
|
||||
labelPosition: LabelPosition.Right,
|
||||
doStroke: false,
|
||||
})
|
||||
|
||||
@@ -229,7 +230,7 @@ export class NodeOutputSlot extends NodeSlot implements INodeOutputSlot {
|
||||
return this.links != null && this.links.length > 0
|
||||
}
|
||||
|
||||
override draw(ctx: CanvasRenderingContext2D, options: Omit<IDrawOptions, "doStroke">) {
|
||||
override draw(ctx: CanvasRenderingContext2D, options: Omit<IDrawOptions, "doStroke" | "labelPosition">) {
|
||||
const originalTextAlign = ctx.textAlign
|
||||
const originalStrokeStyle = ctx.strokeStyle
|
||||
ctx.textAlign = options.horizontal ? "center" : "right"
|
||||
@@ -237,6 +238,7 @@ export class NodeOutputSlot extends NodeSlot implements INodeOutputSlot {
|
||||
|
||||
super.draw(ctx, {
|
||||
...options,
|
||||
labelPosition: LabelPosition.Left,
|
||||
doStroke: true,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user