MCPcopy Create free account
hub / github.com/Comfy-Org/litegraph.js / processSelect

Method processSelect

src/LGraphCanvas.ts:3689–3713  ·  view source on GitHub ↗

* Determines whether to select or deselect an item that has received a pointer event. Will deselect other nodes if * @param item Canvas item to select/deselect * @param e The MouseEvent to handle * @param sticky Prevents deselecting individual nodes (as used by aux/right-click) * @remar

(
    item: TPositionable | null | undefined,
    e: CanvasPointerEvent | undefined,
    sticky: boolean = false,
  )

Source from the content-addressed store, hash-verified

3687 * Accessibility: anyone using {@link mutli_select} always deselects when clicking empty space.
3688 */
3689 processSelect<TPositionable extends Positionable = LGraphNode>(
3690 item: TPositionable | null | undefined,
3691 e: CanvasPointerEvent | undefined,
3692 sticky: boolean = false,
3693 ): void {
3694 const addModifier = e?.shiftKey
3695 const subtractModifier = e != null && (e.metaKey || e.ctrlKey)
3696 const eitherModifier = addModifier || subtractModifier
3697 const modifySelection = eitherModifier || this.multi_select
3698
3699 if (!item) {
3700 if (!eitherModifier || this.multi_select) this.deselectAll()
3701 } else if (!item.selected || !this.selectedItems.has(item)) {
3702 if (!modifySelection) this.deselectAll(item)
3703 this.select(item)
3704 } else if (modifySelection && !sticky) {
3705 this.deselect(item)
3706 } else if (!sticky) {
3707 this.deselectAll(item)
3708 } else {
3709 return
3710 }
3711 this.onSelectionChange?.(this.selected_nodes)
3712 this.setDirty(true)
3713 }
3714
3715 /**
3716 * Selects a {@link Positionable} item.

Callers 7

processMouseDownMethod · 0.95
#processPrimaryButtonMethod · 0.95
#processNodeClickMethod · 0.95
#startDraggingItemsMethod · 0.95
processNodeSelectedMethod · 0.95
processSubgraphIONodeMethod · 0.80

Calls 5

deselectAllMethod · 0.95
selectMethod · 0.95
deselectMethod · 0.95
setDirtyMethod · 0.95
hasMethod · 0.80

Tested by

no test coverage detected