Lib.dragMouse
Lib › dragMouse
Type: (this: void, params: DragMouseParams) => Promise<void>
Drags the mouse from one point to another using **trusted** Electron pointer input, with the button held throughout.It sends a
mouseMove to DragMouseParams.from, a mouseDown there, DragMouseParams.steps mouseMoves along the straight line to DragMouseParams.to that carry the held button, and a mouseUp at to. Chromium turns that into real pointerdown → pointermove … → pointerup events with isTrusted === true and buttons reporting the held button, which is what a pointer-capture drag handler reads. Each move waits one animation frame, so a handler that does its work per frame sees every step rather than one coalesced jump.Lib.clickMouse cannot do this: its button goes down and up at one point, so a handler that starts a drag only after the pointer has moved a few pixels (Obsidian's canvas connection handles, for one) never starts. A dispatched
PointerEvent does not work either, because Obsidian's handlers ignore untrusted input.It is a low-level primitive and waits for no effect: the caller polls for what the drop should have produced, with Lib.waitUntil.
**Desktop only — it throws on mobile.** A touch drag would need its own host-side gesture, and nothing asks for one yet; a silent no-op would let a test assert against a drag that never happened.
**Must be awaited** — see Lib.clickElement.