mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-31 13:29:55 +00:00
[Cleanup] Removes unused code (#996)
- Removes unused code - Removes unnecessary globalAlpha reset when drawing reroute highlight
This commit is contained in:
@@ -1189,9 +1189,9 @@ export class LGraph implements LinkNetwork, Serialisable<SerialisableGraph> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a reroute by ID, or `undefined` if the ID is `null` or `undefined`.
|
||||
* @param id ID of reroute to return
|
||||
* @returns The reroute with the provided {@link id}, otherwise `undefined`. Always returns `undefined` if `id` is `null` or `undefined`.
|
||||
* Finds the reroute with the provided ID.
|
||||
* @param id ID of reroute to find
|
||||
* @returns The reroute with the provided {@link id}, otherwise `undefined`. Always returns `undefined` if `id` is nullish.
|
||||
*/
|
||||
getReroute(id: null | undefined): undefined
|
||||
getReroute(id: RerouteId | null | undefined): Reroute | undefined
|
||||
|
||||
@@ -4037,12 +4037,7 @@ export class LGraphCanvas {
|
||||
if (!LiteGraph.snap_highlights_node || !linkConnector.isConnecting || linkConnectorSnap) return
|
||||
|
||||
// Reroute highlight
|
||||
if (overReroute) {
|
||||
const { globalAlpha } = ctx
|
||||
ctx.globalAlpha = 1
|
||||
overReroute.drawHighlight(ctx, "#ffcc00aa")
|
||||
ctx.globalAlpha = globalAlpha
|
||||
}
|
||||
overReroute?.drawHighlight(ctx, "#ffcc00aa")
|
||||
|
||||
// Ensure we're mousing over a node and connecting a link
|
||||
const node = this.node_over
|
||||
|
||||
@@ -253,12 +253,6 @@ export interface IBoundaryNodes {
|
||||
|
||||
export type Direction = "top" | "bottom" | "left" | "right"
|
||||
|
||||
export interface IOptionalSlotData<TSlot extends INodeInputSlot | INodeOutputSlot> {
|
||||
content: string
|
||||
value: TSlot
|
||||
className?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* A string that represents a specific data / slot type, e.g. `STRING`.
|
||||
*
|
||||
|
||||
@@ -109,7 +109,6 @@ export type {
|
||||
INodeInputSlot,
|
||||
INodeOutputSlot,
|
||||
INodeSlot,
|
||||
IOptionalSlotData,
|
||||
ISlotType,
|
||||
KeysOfType,
|
||||
LinkNetwork,
|
||||
|
||||
@@ -115,18 +115,6 @@ export function isInsideRectangle(
|
||||
top + height > y
|
||||
}
|
||||
|
||||
/**
|
||||
* Cheap, low accuracy check to determine if a point is roughly inside a sort-of octagon
|
||||
* @param x Point x
|
||||
* @param y Point y
|
||||
* @param radius Radius to use as rough guide for octagon
|
||||
* @returns `true` if the point is roughly inside the octagon centred on 0,0 with specified radius
|
||||
*/
|
||||
export function isSortaInsideOctagon(x: number, y: number, radius: number): boolean {
|
||||
const sum = Math.min(radius, Math.abs(x)) + Math.min(radius, Math.abs(y))
|
||||
return sum < radius * 0.75
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if two rectangles have any overlap
|
||||
* @param a Rectangle A as `x, y, width, height`
|
||||
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
isInRectangle,
|
||||
isInsideRectangle,
|
||||
isPointInRect,
|
||||
isSortaInsideOctagon,
|
||||
overlapBounding,
|
||||
rotateLink,
|
||||
snapPoint,
|
||||
@@ -154,25 +153,6 @@ test("isInsideRectangle handles edge cases differently from isInRectangle", ({ e
|
||||
expect(isInsideRectangle(11, 5, 0, 0, 10, 10)).toBe(false)
|
||||
})
|
||||
|
||||
test("isSortaInsideOctagon approximates octagon containment", ({ expect }) => {
|
||||
const radius = 10
|
||||
|
||||
// Points clearly inside
|
||||
expect(isSortaInsideOctagon(0, 0, radius)).toBe(true)
|
||||
expect(isSortaInsideOctagon(3, 3, radius)).toBe(true)
|
||||
|
||||
// Points on diagonal (roughly on octagon edge)
|
||||
expect(isSortaInsideOctagon(7, 7, radius)).toBe(false)
|
||||
|
||||
// Points clearly outside
|
||||
expect(isSortaInsideOctagon(10, 10, radius)).toBe(false)
|
||||
expect(isSortaInsideOctagon(-10, -10, radius)).toBe(false)
|
||||
|
||||
// Points on axes
|
||||
expect(isSortaInsideOctagon(radius * 0.5, 0, radius)).toBe(true)
|
||||
expect(isSortaInsideOctagon(0, radius * 0.5, radius)).toBe(true)
|
||||
})
|
||||
|
||||
test("containsRect correctly identifies nested rectangles", ({ expect }) => {
|
||||
const container: Rect = [0, 0, 20, 20]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user