# ViewRect

> Talos next · Since 0.7

A view's rectangle, fractions of the window from its top-left corner.

## Signature

```ts
export interface ViewRect {
  /** Left edge, as a fraction of the window width (0 is the left edge). */
  readonly x: number
  /** Top edge, as a fraction of the window height (0 is the top edge). */
  readonly y: number
  /** Width, as a fraction of the window width. */
  readonly width: number
  /** Height, as a fraction of the window height. */
  readonly height: number
}
```

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

## Members

| Member | Signature | Description |
|---|---|---|
| `x` | `readonly x: number` | Left edge, as a fraction of the window width (0 is the left edge). |
| `y` | `readonly y: number` | Top edge, as a fraction of the window height (0 is the top edge). |
| `width` | `readonly width: number` | Width, as a fraction of the window width. |
| `height` | `readonly height: number` | Height, as a fraction of the window height. |

## Example

The tested fixture `fixtures/app/agent.ts`.

```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
```
