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

Method processMouseMove

src/LGraphCanvas.ts:2761–3026  ·  view source on GitHub ↗

* Called when a mouse move event has to be processed

(e: PointerEvent)

Source from the content-addressed store, hash-verified

2759 * Called when a mouse move event has to be processed
2760 */
2761 processMouseMove(e: PointerEvent): void {
2762 if (this.dragZoomEnabled && e.ctrlKey && e.shiftKey && this.#dragZoomStart) {
2763 this.#processDragZoom(e)
2764 return
2765 }
2766
2767 if (this.autoresize) this.resize()
2768
2769 if (this.set_canvas_dirty_on_mouse_event) this.dirty_canvas = true
2770
2771 const { graph, resizingGroup, linkConnector, pointer, subgraph } = this
2772 if (!graph) return
2773
2774 LGraphCanvas.active_canvas = this
2775 this.adjustMouseEvent(e)
2776 const mouse: ReadOnlyPoint = [e.clientX, e.clientY]
2777 this.mouse[0] = mouse[0]
2778 this.mouse[1] = mouse[1]
2779 const delta = [
2780 mouse[0] - this.last_mouse[0],
2781 mouse[1] - this.last_mouse[1],
2782 ]
2783 this.last_mouse = mouse
2784 const { canvasX: x, canvasY: y } = e
2785 this.graph_mouse[0] = x
2786 this.graph_mouse[1] = y
2787
2788 if (e.isPrimary) pointer.move(e)
2789
2790 /** See {@link state}.{@link LGraphCanvasState.hoveringOver hoveringOver} */
2791 let underPointer = CanvasItem.Nothing
2792 if (subgraph) {
2793 underPointer |= subgraph.inputNode.onPointerMove(e)
2794 underPointer |= subgraph.outputNode.onPointerMove(e)
2795 }
2796
2797 if (this.block_click) {
2798 e.preventDefault()
2799 return
2800 }
2801
2802 e.dragging = this.last_mouse_dragging
2803
2804 if (this.node_widget) {
2805 // Legacy widget mouse callbacks for pointermove events
2806 const [node, widget] = this.node_widget
2807
2808 if (widget?.mouse) {
2809 const relativeX = x - node.pos[0]
2810 const relativeY = y - node.pos[1]
2811 const result = widget.mouse(e, [relativeX, relativeY], node)
2812 if (result != null) this.dirty_canvas = result
2813 }
2814 }
2815
2816 // get node over
2817 const node = graph.getNodeOnPos(
2818 x,

Callers

nothing calls this directly

Calls 15

#processDragZoomMethod · 0.95
resizeMethod · 0.95
adjustMouseEventMethod · 0.95
#dirtyMethod · 0.95
updateMouseOverNodesMethod · 0.95
#updateReroutesMethod · 0.95
#getLinkCentreOnPosMethod · 0.95
isOverNodeInputFunction · 0.90
isOverNodeOutputFunction · 0.90
getAllNestedItemsFunction · 0.90
onPointerMoveMethod · 0.80
mouseMethod · 0.80

Tested by

no test coverage detected