InputPointer
Since 0.7
ctx.input.pointer: the mouse in one view's cell.
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
| Member | Signature | Description |
|---|---|---|
view | readonly view: number | The split-screen view under the mouse, 1 to 4 (1 without a layout). |
x | readonly x: number | Pixels from the cell's left edge. |
y | readonly y: number | Pixels 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