Fix group deselected on title click (#230)

This commit is contained in:
filtered
2024-10-28 12:10:08 +11:00
committed by GitHub
parent 92ac193640
commit 83cb795301
2 changed files with 7 additions and 2 deletions

View File

@@ -2820,7 +2820,7 @@ export class LGraphCanvas {
this.visible_nodes
)
if (!node && e.click_time < 300) {
if (!node && e.click_time < 300 && !this.graph.groups.some(x => x.isPointInTitlebar(e.canvasX, e.canvasY))) {
this.deselectAllNodes()
}

View File

@@ -3,7 +3,7 @@ import type { LGraph } from "./LGraph"
import type { ISerialisedGroup } from "./types/serialisation"
import { LiteGraph } from "./litegraph"
import { LGraphCanvas } from "./LGraphCanvas"
import { overlapBounding } from "./measure"
import { isInsideRectangle, overlapBounding } from "./measure"
import { LGraphNode } from "./LGraphNode"
export interface IGraphGroup {
@@ -259,6 +259,11 @@ export class LGraphGroup {
]
}
isPointInTitlebar(x: number, y: number): boolean {
const b = this._bounding
return isInsideRectangle(x, y, b[0], b[1], b[2], this.titleHeight)
}
isPointInside = LGraphNode.prototype.isPointInside
setDirtyCanvas = LGraphNode.prototype.setDirtyCanvas
}