@mocanvas/editor · interface
interface EditorInputsLive pointer and modifier state.
The *ScreenPoint members are in VIEWPORT space (container-relative
pixels), which is the space canvas events arrive in; *PagePoint are in
page space. For a window-relative point use editor.pageToScreen(...).
Every field also has a get…() accessor. The two are the same storage: the
field is what the editor's dispatch loop writes, the accessor is what
application code should read. Reading through the accessor is what lets the
state move behind a signal later without every call site changing — which is
the whole reason the accessors exist — so new code should prefer
inputs.getCurrentPagePoint() over inputs.currentPagePoint.
On this page
Methods · 20
getAccelKey(): booleanThe platform's "accelerator": metaKey on Apple platforms, ctrlKey elsewhere.
getAltKey(): booleangetButtons(): Set<number>Pointer buttons currently held down.
getCtrlKey(): booleangetCurrentPagePoint(): VecPage-space pointer position right now.
getCurrentScreenPoint(): VecViewport-space pointer position right now.
getIsDragging(): booleanWhether the pointer has moved far enough since going down to count as a drag.
getIsEditing(): booleangetIsPanning(): booleangetIsPen(): booleanWhether the active pointer is a pen.
getIsPinching(): booleangetIsPointing(): booleanWhether a pointer button is down.
getKeys(): Set<string>Codes of the keys currently held down.
getMetaKey(): booleangetOriginPagePoint(): VecPage-space point the current gesture started at.
getOriginScreenPoint(): VecViewport-space point the current gesture started at.
getPointerVelocity(): VecPointer movement per millisecond, in page units.
getPreviousPagePoint(): VecPage-space pointer position at the previous event.
getPreviousScreenPoint(): VecViewport-space pointer position at the previous event.
getShiftKey(): booleanProperties · 20
accelKey: booleanaltKey: booleanbuttons: Set<number>ctrlKey: booleancurrentPagePoint: VeccurrentScreenPoint: VecisDragging: booleanisEditing: booleanisPanning: booleanisPen: booleanisPinching: booleanisPointing: booleankeys: Set<string>metaKey: booleanoriginPagePoint: VecoriginScreenPoint: VecpointerVelocity: VecpreviousPagePoint: VecpreviousScreenPoint: VecshiftKey: booleanmocanvas 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.