@mocanvas/editor · function

setPointerCapture

declare function setPointerCapture(element: Element, event: {
    pointerId: number;
}): void

Keep sending this pointer's events to element until it is released, even once the pointer leaves the element's box.

Without it, dragging a resize handle past the edge of the canvas silently stops updating: the events start going to whatever is under the cursor. Every drag the editor starts takes capture and releases it on pointer up.

Never throws. Capture legitimately fails when the pointer has already been lifted — a fast drag out of the window — and there is nothing useful to do about that but carry on.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.