From d51a0d6a5d337cfe5f4e4bb0f0c805fcab7cc2fb Mon Sep 17 00:00:00 2001 From: huchenlei Date: Tue, 27 Aug 2024 10:35:36 -0400 Subject: [PATCH] Double click edit node title --- src/components/graph/GraphCanvas.vue | 2 + src/components/graph/NodeTitleEditor.vue | 92 ++++++++++++++++++++++++ src/scripts/app.ts | 8 +++ 3 files changed, 102 insertions(+) create mode 100644 src/components/graph/NodeTitleEditor.vue diff --git a/src/components/graph/GraphCanvas.vue b/src/components/graph/GraphCanvas.vue index a53197476..995342a3c 100644 --- a/src/components/graph/GraphCanvas.vue +++ b/src/components/graph/GraphCanvas.vue @@ -5,6 +5,7 @@ + @@ -12,6 +13,7 @@ + + diff --git a/src/scripts/app.ts b/src/scripts/app.ts index 48373ff3b..1450f7746 100644 --- a/src/scripts/app.ts +++ b/src/scripts/app.ts @@ -3006,6 +3006,14 @@ export class ComfyApp { ) as Vector2 } + canvasPosToClientPos(pos: Vector2): Vector2 { + const rect = this.canvasContainer.getBoundingClientRect() + const containerOffsets = [rect.left, rect.top] + return _.zip(pos, this.canvas.ds.offset, containerOffsets).map( + ([p, o1, o2]) => (p + o1) * this.canvas.ds.scale + o2 + ) as Vector2 + } + getCanvasCenter(): Vector2 { const dpi = Math.max(window.devicePixelRatio ?? 1, 1) const [x, y, w, h] = app.canvas.ds.visible_area