mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-01 13:59:54 +00:00
forward mouse events from textareas to canvas (#1911)
* forward mouse events from textareas to canvas * use arrow functions * Apply suggestions from code review Use pointer events instead of mouse to get extended properties Remove workaround (only required due to missing extended properties) * Apply code review - Adjust UX - Do not prevent middle click from hitting DOM widgets - Allow middle click and drag to continue functioning if another button is held down --------- Co-authored-by: filtered <176114999+webfiltered@users.noreply.github.com>
This commit is contained in:
@@ -341,6 +341,24 @@ function addMultilineWidget(node, name: string, opts, app: ComfyApp) {
|
||||
widget.callback?.(widget.value)
|
||||
})
|
||||
|
||||
inputEl.addEventListener('pointerdown', (event: PointerEvent) => {
|
||||
if (event.button === 1) {
|
||||
app.canvas.processMouseDown(event)
|
||||
}
|
||||
})
|
||||
|
||||
inputEl.addEventListener('pointermove', (event: PointerEvent) => {
|
||||
if ((event.buttons & 4) === 4) {
|
||||
app.canvas.processMouseMove(event)
|
||||
}
|
||||
})
|
||||
|
||||
inputEl.addEventListener('pointerup', (event: PointerEvent) => {
|
||||
if (event.button === 1) {
|
||||
app.canvas.processMouseUp(event)
|
||||
}
|
||||
})
|
||||
|
||||
return { minWidth: 400, minHeight: 200, widget }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user