Skip to content

Commit

Permalink
Fix pin not respected by multi-select move (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
webfiltered authored Nov 7, 2024
1 parent 80cbe49 commit 1c40aad
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/LGraphCanvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2444,7 +2444,7 @@ export class LGraphCanvas {
this.#dirty()

function addToSetRecursively(item: Positionable, items: Set<Positionable>): void {
if (items.has(item)) return
if (items.has(item) || item.pinned) return
items.add(item)
item.children?.forEach(x => addToSetRecursively(x, items))
}
Expand Down
2 changes: 2 additions & 0 deletions src/LGraphNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1437,6 +1437,8 @@ export class LGraphNode implements Positionable, IPinnable {
}

move(deltaX: number, deltaY: number): void {
if (this.pinned) return

this.pos[0] += deltaX
this.pos[1] += deltaY
}
Expand Down
3 changes: 3 additions & 0 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export interface Positionable {
/** true if this object is part of the selection, otherwise false. */
selected?: boolean

/** See {@link IPinnable.pinned} */
readonly pinned?: boolean

readonly children?: ReadonlySet<Positionable>

/**
Expand Down

0 comments on commit 1c40aad

Please sign in to comment.