# SharedSplit

> Talos 0.7 · Since 0.7

{@link ViewsHandle.shared}'s `split` options: when the shared camera splits into one view per target, and when it merges back.

Absent or invalid numbers keep the default.

## Signature

```ts
export interface SharedSplit {
  /**
   * How two targets split the window: `"auto"` (the default) is `"left-right"` in a window wider than
   * it is tall and `"top-bottom"` otherwise. Three targets always split as `"three"`, four as `"grid"`.
   */
  layout?: "auto" | "left-right" | "top-bottom"
  /**
   * Split once the targets' spread (the widest distance between two of them, metres) is beyond this.
   * Default: the spread at which the shared camera reaches `maxDistance` (at `maxFov`, if given).
   */
  beyond?: number
  /** Merge once the spread is back under this, metres. Default: three quarters of `beyond`; never above it. */
  back?: number
  /** Seconds of game time a split's or a merge's condition must hold, unbroken, before it happens. Default 0.5. */
  hold?: number
}
```

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

## Members

| Member | Signature | Description |
|---|---|---|
| `layout` | `layout?: "auto" \| "left-right" \| "top-bottom"` | How two targets split the window: `"auto"` (the default) is `"left-right"` in a window wider than it is tall and `"top-bottom"` otherwise. Three targets always split as `"three"`, four as `"grid"`. |
| `beyond` | `beyond?: number` | Split once the targets' spread (the widest distance between two of them, metres) is beyond this. Default: the spread at which the shared camera reaches `maxDistance` (at `maxFov`, if given). |
| `back` | `back?: number` | Merge once the spread is back under this, metres. Default: three quarters of `beyond`; never above it. |
| `hold` | `hold?: number` | Seconds of game time a split's or a merge's condition must hold, unbroken, before it happens. Default 0.5. |

## Example

The tested fixture `fixtures/host/lifecycle.ts`.

```ts
import type { Behavior } from "@argus/api"
// Logs every lifecycle callback with the arguments it received.
export default {
  init(ctx) { ctx.log("init", { props: ctx.props, entity: ctx.entity.id }) },
  update(ctx, dt) { ctx.log("update", { dt }) },
  dispose(ctx) { ctx.log("dispose") },
  onCollision(ctx, c) { ctx.log("onCollision", { other: c.other.id, impulse: c.impulse }) },
  onTrigger(ctx, tr) { ctx.log("onTrigger", { event: tr.event, other: tr.other.id, entering: tr.entering }) },
  onEvent(ctx, ev) { ctx.log("onEvent", { name: ev.name, data: ev.data, by: ev.by }) },
} satisfies Behavior
```
