Remove LayoutElement, resolve root TS issues (#953)

- Converts type assertions to use inference via discriminated unions
- Removes the LayoutElement class (only used by node slots, and recently
reduced to a single function)
- Splits `boundingRect` property out from `Positionable` interface
- Slots now use the standard `boundingRect` property
- Perf improvements / Removes redundant code
This commit is contained in:
filtered
2025-04-21 22:23:09 +10:00
committed by GitHub
parent f7a0a92f3a
commit 2ad1481f02
6 changed files with 92 additions and 95 deletions

View File

@@ -1,18 +0,0 @@
import { Point, ReadOnlyRect } from "@/interfaces"
export class LayoutElement {
public readonly boundingRect: ReadOnlyRect
constructor(o: {
boundingRect: ReadOnlyRect
}) {
this.boundingRect = o.boundingRect
}
get center(): Point {
return [
this.boundingRect[0] + this.boundingRect[2] / 2,
this.boundingRect[1] + this.boundingRect[3] / 2,
]
}
}