From 2e95ac9a71b16d98640047a2d7a19548f01d0a9f Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Sun, 23 Mar 2025 06:36:14 +1100 Subject: [PATCH] Fix minor render issues with links / reroutes (#825) - Fixes link centre marker highlight drawn over dragged items - Fixes arrow-style link centre marker drawn twice - Adds missing centre markers for output floating links - Adds render sort order for reroutes (more links rendered on top) --- src/LGraphCanvas.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/LGraphCanvas.ts b/src/LGraphCanvas.ts index 21eab36e1..dbf5ea0cb 100644 --- a/src/LGraphCanvas.ts +++ b/src/LGraphCanvas.ts @@ -3878,11 +3878,11 @@ export class LGraphCanvas implements ConnectionColorContext { } // on top of link center - if (this.over_link_center && this.render_link_tooltip) + if (!this.isDragging && this.over_link_center && this.render_link_tooltip) { this.drawLinkTooltip(ctx, this.over_link_center) - // to remove - else + } else { this.onDrawLinkTooltip?.(ctx, null) + } // custom info this.onDrawForeground?.(ctx, this.visible_area) @@ -4617,7 +4617,8 @@ export class LGraphCanvas implements ConnectionColorContext { this.#renderFloatingLinks(ctx, graph, visibleReroutes, now) } - // Render the reroute circles + // Render reroutes, ordered by number of non-floating links + visibleReroutes.sort((a, b) => a.linkIds.size - b.linkIds.size) for (const reroute of visibleReroutes) { if ( this.#snapToGrid && @@ -5026,9 +5027,7 @@ export class LGraphCanvas implements ConnectionColorContext { if ( this.ds.scale >= 0.6 && this.highquality_render && - linkSegment && - // TODO: Re-assess this usage - likely a workaround that linkSegment truthy check resolves - endDir != LinkDirection.CENTER + linkSegment ) { // render arrow if (this.render_connection_arrows) { @@ -5079,7 +5078,6 @@ export class LGraphCanvas implements ConnectionColorContext { ctx.moveTo(-3.2, -5) ctx.lineTo(+7, 0) ctx.lineTo(-3.2, +5) - ctx.fill() ctx.setTransform(transform) } else if ( this.linkMarkerShape == null ||