mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-26 17:30:07 +00:00
Fix Rectangle/Rect type compatibility and unify type system
This commit addresses PR review comments by fixing the fundamental type incompatibility between Rectangle (Array<number>) and strict tuple types (Rect = [x, y, width, height]). Key changes: - Updated Rectangle class methods to accept both Rect and Rectangle unions - Fixed all measure functions (containsRect, overlapBounding, etc.) to accept Rectangle - Updated boundingRect interfaces to consistently use Rectangle instead of Rect - Fixed all tests and Vue components to use Rectangle instead of array literals - Resolved Point type conflicts between litegraph and pathRenderer modules - Removed ReadOnlyPoint types and unified with Point arrays The type system is now consistent: boundingRect properties return Rectangle objects with full functionality, while Rect remains as a simple tuple type for data interchange.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { afterEach, beforeEach, describe, expect, vi } from 'vitest'
|
||||
|
||||
import type { INodeInputSlot, Point } from '@/lib/litegraph/src/litegraph'
|
||||
import { Rectangle } from '@/lib/litegraph/src/litegraph'
|
||||
import { LGraphNode, LiteGraph } from '@/lib/litegraph/src/litegraph'
|
||||
import { LGraph } from '@/lib/litegraph/src/litegraph'
|
||||
import { NodeInputSlot } from '@/lib/litegraph/src/litegraph'
|
||||
@@ -571,7 +572,7 @@ describe('LGraphNode', () => {
|
||||
name: 'test_in',
|
||||
type: 'string',
|
||||
link: null,
|
||||
boundingRect: new Float32Array([0, 0, 0, 0])
|
||||
boundingRect: new Rectangle(0, 0, 0, 0)
|
||||
}
|
||||
})
|
||||
test('should return position based on title height when collapsed', () => {
|
||||
@@ -594,7 +595,7 @@ describe('LGraphNode', () => {
|
||||
name: 'test_in_2',
|
||||
type: 'number',
|
||||
link: null,
|
||||
boundingRect: new Float32Array([0, 0, 0, 0])
|
||||
boundingRect: new Rectangle(0, 0, 0, 0)
|
||||
}
|
||||
node.inputs = [inputSlot, inputSlot2]
|
||||
const slotIndex = 0
|
||||
|
||||
Reference in New Issue
Block a user