# `Macaw.Frame.Hooks.Brush`
[🔗](https://github.com/dcoai/macaw_frame/blob/v0.1.0/lib/macaw/frame/hooks/brush.ex#L1)

The brush's selection helpers (spec/10 §7.5), visualize's `Visualize.Hooks.Brush`
`selection_to_domain/2`: `FrameBrush` emits `"brush"` with a window in domain units it
worked out in the browser; `window(selection, frame)` is the server's inverse, a pixel
selection of the frame's plot (`%{x0, x1}`, and `%{y0, y1}` for a `y` or `xy` brush) read
back through the frame's continuous scales, `{:ok, %{"from" => lo, "to" => hi}}` with
`lo ≤ hi` (and `"y_from"`, `"y_to"` for the y edges), or `{:error, :no_scale}` for a
frame with no continuous scale on the brushed axis. visualize raised on a missing
scale.

# `window`

```elixir
@spec window(map(), Macaw.Frame.Coordinates.Model.t()) ::
  {:ok, map()} | {:error, :no_scale | [Macaw.Base.Fault.t()]}
```

The window a pixel selection of `frame`'s plot stands for.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
