From b40bd06898583a79aa13c3dcfd8d06e146902011 Mon Sep 17 00:00:00 2001 From: Edoardo Carmignani Date: Tue, 10 Jun 2025 01:26:30 +0200 Subject: [PATCH] Cleanup repo --- web/js/_bkup_rounded_corner_straight_link.js | 128 ------------------- web/js/extralinks_register.js | 9 -- 2 files changed, 137 deletions(-) delete mode 100644 web/js/_bkup_rounded_corner_straight_link.js diff --git a/web/js/_bkup_rounded_corner_straight_link.js b/web/js/_bkup_rounded_corner_straight_link.js deleted file mode 100644 index dcd861f..0000000 --- a/web/js/_bkup_rounded_corner_straight_link.js +++ /dev/null @@ -1,128 +0,0 @@ -// import {app} from "../../../scripts/app.js" - -// console.log("INIT RCL") - -// const LinkRenderers = { -// curved: { -// draw: function(ctx, start, end, slot_id, radius, offset, curvature, color, width) { -// const x0 = start[0]; -// const y1 = start[1]; -// const x2 = end[0]; -// const y2 = end[1]; - -// const dx = x2 - x0; -// const dy = y2 - y1; - -// const dirX = Math.sign(dx); -// const dirY = Math.sign(dy); - -// const offsetX = Math.max((slot_id * curvature + offset) * dirX, 0); -// const oX = Math.min(offsetX, (dx * 0.5)) -// const x1 = x0 + oX; - -// const r = Math.min(radius, Math.abs(dx * 0.5), Math.abs(dy * 0.5)); - -// ctx.save(); -// ctx.lineWidth = width; -// ctx.strokeStyle = color; -// ctx.beginPath(); - -// ctx.moveTo(x0, y1); -// ctx.lineTo(x1 - r * dirX, y1); -// ctx.arcTo(x1, y1, x1, y1 + r * dirY, r); -// ctx.lineTo(x1, y2 - r * dirY); -// ctx.arcTo(x1, y2, x1 + r * dirX, y2, r); -// ctx.lineTo(x2, y2); - -// ctx.stroke(); -// ctx.restore(); -// } -// }, - -// rounded: { -// draw: function(ctx, start, end, radius, color, width) { -// const x0 = start[0]; -// const y1 = start[1]; -// const x2 = end[0]; -// const y2 = end[1]; - -// const dx = x2 - x0; -// const dy = y2 - y1; - -// const dirX = Math.sign(dx); -// const dirY = Math.sign(dy); - -// const r = Math.min(radius, Math.abs(dx * 0.5), Math.abs(dy * 0.5)); - -// ctx.save(); -// ctx.lineWidth = width; -// ctx.strokeStyle = color; -// ctx.beginPath(); - -// ctx.moveTo(x0, y1); -// ctx.lineTo(midX - r * dirX, y1); -// ctx.arcTo(midX, y1, midX, y1 + r * dirY, r); -// ctx.lineTo(midX, y2 - r * dirY); -// ctx.arcTo(midX, y2, midX + r * dirX, y2, r); -// ctx.lineTo(x2, y2); - -// ctx.stroke(); -// ctx.restore(); -// } -// } -// } - -// class RoundedCornerLines { -// #visibleReroutes = /* @__PURE__ */ new Set(); -// #snapToGrid; -// init() { -// const RADIUS = 20; -// const OFFSET = 25; -// const CURVATURE = 5; -// const oldDrawConnections = LGraphCanvas.prototype.drawConnections; -// LGraphCanvas.prototype.drawConnections = function drawConnections(ctx, ) { -// this.renderedPaths.clear(); -// const { graph } = this; - -// const nodes = graph._nodes; -// for (const node22 of nodes) { -// const { inputs } = node22; -// if (!inputs?.length) continue; -// for (const [i2, input] of inputs.entries()) { -// if (!input || input.link == null) continue; -// const link_id = input.link; -// const link2 = graph._links.get(link_id); -// const linkColour = link2 != null && this.highlighted_links[link2.id] ? "#FFF" : link2?.color || link2?.type != null && LGraphCanvas.link_type_colors[link2.type] || this.default_link_color; -// if (!link2) continue; -// const endPos = node22.getInputPos(i2); -// const start_node = graph.getNodeById(link2.origin_id); -// if (start_node == null) continue; -// const outputId = link2.origin_slot; -// const startPos = outputId === -1 ? [start_node.pos[0] + 10, start_node.pos[1] + 10] : start_node.getOutputPos(outputId); -// const output = start_node.outputs[outputId]; -// if (!output) continue; - -// // if (this.linkConnector.isConnecting) { -// // const { renderLinks } = this.linkConnector; -// // for (const renderLink of renderLinks) { -// // const { fromPos: pos } = renderLink; -// // const hpos = this._highlighted_links ?? this.graph_mouse; - -// // LinkRenderers["curved"].draw(ctx, pos, hpos, outputId, RADIUS, OFFSET, CURVATURE, "#FFF", this.connections_width*2); -// // } - -// // } - -// LinkRenderers["curved"].draw(ctx, startPos, endPos, outputId, RADIUS, OFFSET, CURVATURE, linkColour, this.connections_width); - -// // 2) *right here*—draw & hook up the midpoint marker -// LiteGraph.LGraphCanvas -// .prototype -// .drawLinkPoints -// .call(this, ctx, link2, startPos, endPos); -// } -// } -// } - -// const rcl = new RoundedCornerLines(); -// rcl.init(); \ No newline at end of file diff --git a/web/js/extralinks_register.js b/web/js/extralinks_register.js index 1a3c64c..5e5a49d 100644 --- a/web/js/extralinks_register.js +++ b/web/js/extralinks_register.js @@ -1,15 +1,6 @@ import {app} from "../../../scripts/app.js" import { ExtraLinks } from "./ExtraLinks.js" -function repaintAll() { - const canvas = app.graph?.canvas; - if (canvas) { - if (canvas.renderedPaths) canvas.renderedPaths.clear(); - canvas.setDirty(true, true); - canvas.draw(true, true); - } -} - app.registerExtension({ name: "Extra Links", settings: [