From b19758c8d11324a533e0cff8eedd21391960b673 Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Sat, 30 Nov 2024 22:09:21 +1100 Subject: [PATCH 1/2] Snap groups to grid after auto-fitting Prevents unexpected snapping on workflow reload, undo/redo, etc. --- src/LGraphGroup.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/LGraphGroup.ts b/src/LGraphGroup.ts index cde512c..402419b 100644 --- a/src/LGraphGroup.ts +++ b/src/LGraphGroup.ts @@ -263,6 +263,9 @@ export class LGraphGroup implements Positionable, IPinnable { this.pos[1] = boundingBox[1] - this.titleHeight this.size[0] = boundingBox[2] this.size[1] = boundingBox[3] + this.titleHeight + + const snapTo = this.graph?.getSnapToGridSize() + if (snapTo) this.snapToGrid(snapTo) } /** From 721c312bec7c3db3ad936634578ce4c0ba417e2c Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Sat, 30 Nov 2024 22:09:29 +1100 Subject: [PATCH 2/2] nit --- src/LGraphGroup.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/LGraphGroup.ts b/src/LGraphGroup.ts index 402419b..0bd2524 100644 --- a/src/LGraphGroup.ts +++ b/src/LGraphGroup.ts @@ -18,7 +18,6 @@ import { snapPoint, } from "./measure" import { LGraphNode } from "./LGraphNode" -import { RenderShape, TitleMode } from "./types/globalEnums" export interface IGraphGroupFlags extends Record { pinned?: true