mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-26 01:34:07 +00:00
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:
@@ -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,
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user