fix: correctly handle node wrapper resizing
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 1m57s

This commit is contained in:
Max Richter
2025-12-01 19:48:40 +01:00
parent 1850e21810
commit a1ea56093c

View File

@@ -26,15 +26,16 @@ export class GraphState {
constructor(private graph: GraphManager) { } constructor(private graph: GraphManager) { }
cameraPosition: [number, number, number] = $state([0, 0, 4]); width = $state(100);
wrapper = $state<HTMLDivElement>(null!); height = $state(100);
wrapper = $state<HTMLDivElement>(null!);
rect: DOMRect = $derived( rect: DOMRect = $derived(
this.wrapper ? this.wrapper.getBoundingClientRect() : new DOMRect(0, 0, 0, 0), (this.wrapper && this.width && this.height) ? this.wrapper.getBoundingClientRect() : new DOMRect(0, 0, 0, 0),
); );
width = $derived(this.rect?.width ?? 100);
height = $derived(this.rect?.height ?? 100);
camera = $state<OrthographicCamera>(null!); camera = $state<OrthographicCamera>(null!);
cameraPosition: [number, number, number] = $state([0, 0, 4]);
clipboard: null | { clipboard: null | {
nodes: Node[]; nodes: Node[];