[fix] Replace ES2023 toReversed() with ES2022-compatible implementation

Replaced array.toReversed() method calls with backwards iteration loops
to maintain compatibility with ES2022 target in TypeScript configuration.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Benjamin Lu
2025-08-04 04:05:17 -04:00
parent fc287a830c
commit 579201945e

View File

@@ -1054,7 +1054,14 @@ export class LGraph implements LinkNetwork, BaseLGraph, Serialisable<Serialisabl
* @returns The group or null
*/
getGroupOnPos(x: number, y: number): LGraphGroup | undefined {
return this._groups.toReversed().find(g => g.isPointInside(x, y))
// Iterate backwards through groups to find top-most
for (let i = this._groups.length - 1; i >= 0; i--) {
const group = this._groups[i]
if (group.isPointInside(x, y)) {
return group
}
}
return undefined
}
/**
@@ -1064,7 +1071,14 @@ export class LGraph implements LinkNetwork, BaseLGraph, Serialisable<Serialisabl
* @returns The group or null
*/
getGroupTitlebarOnPos(x: number, y: number): LGraphGroup | undefined {
return this._groups.toReversed().find(g => g.isPointInTitlebar(x, y))
// Iterate backwards through groups to find top-most
for (let i = this._groups.length - 1; i >= 0; i--) {
const group = this._groups[i]
if (group.isPointInTitlebar(x, y)) {
return group
}
}
return undefined
}
/**