mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-07 16:40:05 +00:00
refactor: use read_only as signal, let events bubble to litegraph
- Set canvas.read_only directly when spacebar pressed - Skip stopPropagation when read_only is true in slot link handler - Remove manual dragging_canvas and processMouseMove management - Litegraph handles panning through its normal event handlers
This commit is contained in:
@@ -32,17 +32,8 @@ watch(space, (isPressed) => {
|
||||
if (activeElement.value === canvas.canvas) return
|
||||
if (isEditableElement(activeElement.value || null)) return
|
||||
|
||||
// Mirror litegraph's processKey behavior for spacebar
|
||||
if (isPressed) {
|
||||
canvas.read_only = true
|
||||
// Set dragging_canvas based on current pointer state
|
||||
if (canvas.pointer?.isDown) {
|
||||
canvas.dragging_canvas = true
|
||||
}
|
||||
} else {
|
||||
canvas.read_only = false
|
||||
canvas.dragging_canvas = false
|
||||
}
|
||||
// pointer events will bubble to litegraph
|
||||
canvas.read_only = isPressed
|
||||
})
|
||||
|
||||
export function useNodePointerInteractions(
|
||||
|
||||
@@ -410,13 +410,8 @@ export function useSlotLinkInteraction({
|
||||
const handlePointerMove = (event: PointerEvent) => {
|
||||
if (!pointerSession.matches(event)) return
|
||||
|
||||
const canvas = app.canvas
|
||||
// When spacebar is held (read_only=true) and left mouse button is down,
|
||||
// delegate to litegraph's processMouseMove for panning
|
||||
const isLeftButtonDown = (event.buttons & 1) !== 0
|
||||
if (canvas?.read_only && isLeftButtonDown) {
|
||||
canvas.processMouseMove(event)
|
||||
}
|
||||
// When in panning mode (read_only), let events bubble to litegraph
|
||||
if (app.canvas?.read_only) return
|
||||
|
||||
event.stopPropagation()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user