Talos docs

InputPointer

Since 0.7

ctx.input.pointer: the mouse in one view's cell.

Plain text

Signature

export interface InputPointer {
  /** The split-screen view under the mouse, 1 to 4 (1 without a layout). */
  readonly view: number
  /** Pixels from the cell's left edge. */
  readonly x: number
  /** Pixels from the cell's top edge. */
  readonly y: number
}

Import: import type { InputPointer } from "@argus/api"

Members

MemberSignatureDescription
viewreadonly view: numberThe split-screen view under the mouse, 1 to 4 (1 without a layout).
xreadonly x: numberPixels from the cell's left edge.
yreadonly y: numberPixels from the cell's top edge.

Example

The tested fixture fixtures/app/agent.ts.

import type { Behavior } from "@argus/api"

// Sends a nav agent to `props.target` once, then reports arrival through ctx.state so the
// test can read it without polling the crowd directly.
export default {
  init(ctx) {
    ctx.state.arrived = false
    ctx.nav?.goTo(ctx.props.target as [number, number, number])
  },
  update(ctx) {
    if (ctx.nav?.arrived) ctx.state.arrived = true
  },
} satisfies Behavior