* Called when a mouse up event has to be processed
(e: PointerEvent)
| 3103 | * Called when a mouse up event has to be processed |
| 3104 | */ |
| 3105 | processMouseUp(e: PointerEvent): void { |
| 3106 | // early exit for extra pointer |
| 3107 | if (e.isPrimary === false) return |
| 3108 | |
| 3109 | const { graph, pointer } = this |
| 3110 | if (!graph) return |
| 3111 | |
| 3112 | LGraphCanvas.active_canvas = this |
| 3113 | |
| 3114 | this.adjustMouseEvent(e) |
| 3115 | |
| 3116 | const now = LiteGraph.getTime() |
| 3117 | e.click_time = now - this.last_mouseclick |
| 3118 | |
| 3119 | /** The mouseup event occurred near the mousedown event. */ |
| 3120 | /** Normal-looking click event - mouseUp occurred near mouseDown, without dragging. */ |
| 3121 | const isClick = pointer.up(e) |
| 3122 | if (isClick === true) { |
| 3123 | pointer.isDown = false |
| 3124 | pointer.isDouble = false |
| 3125 | // Required until all link behaviour is added to Pointer API |
| 3126 | this.connecting_links = null |
| 3127 | this.dragging_canvas = false |
| 3128 | |
| 3129 | graph.change() |
| 3130 | |
| 3131 | e.stopPropagation() |
| 3132 | e.preventDefault() |
| 3133 | return |
| 3134 | } |
| 3135 | |
| 3136 | this.last_mouse_dragging = false |
| 3137 | this.last_click_position = null |
| 3138 | |
| 3139 | // used to avoid sending twice a click in an immediate button |
| 3140 | this.block_click &&= false |
| 3141 | |
| 3142 | if (e.button === 0) { |
| 3143 | // left button |
| 3144 | this.selected_group = null |
| 3145 | |
| 3146 | this.isDragging = false |
| 3147 | |
| 3148 | const x = e.canvasX |
| 3149 | const y = e.canvasY |
| 3150 | |
| 3151 | if (!this.linkConnector.isConnecting) { |
| 3152 | this.dirty_canvas = true |
| 3153 | |
| 3154 | // @ts-expect-error Unused param |
| 3155 | this.node_over?.onMouseUp?.(e, [x - this.node_over.pos[0], y - this.node_over.pos[1]], this) |
| 3156 | this.node_capturing_input?.onMouseUp?.(e, [ |
| 3157 | x - this.node_capturing_input.pos[0], |
| 3158 | y - this.node_capturing_input.pos[1], |
| 3159 | ]) |
| 3160 | } |
| 3161 | } else if (e.button === 1) { |
| 3162 | // middle button |
nothing calls this directly
no test coverage detected