# `MingaEditor.Window.ScrollVelocity`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_editor/window/scroll_velocity.ex#L1)

Lightweight scroll-rate estimator for gesture detection.

Tracks a sliding window of scroll event timestamps and computes a velocity
tier (:idle, :medium, :fast) based on event rate. The tier is read by
`MingaEditor.Window.scroll_follow_cursor?/3` to tell whether a wheel/trackpad
scroll gesture is in progress, so the render pipeline holds the free-scrolled
viewport instead of re-anchoring to the cursor mid-gesture.

The velocity-aware overscan sizing and directional prefetch that this module
also fed were deleted with full residence on by default and huge files refused
(#2680, epic #2652), which is why only the rate tier remains.

# `t`

```elixir
@type t() :: %MingaEditor.Window.ScrollVelocity{
  count: non_neg_integer(),
  last_event: integer(),
  prev_count: non_neg_integer(),
  window_start: integer()
}
```

# `tier`

```elixir
@type tier() :: :idle | :medium | :fast
```

# `new`

```elixir
@spec new() :: t()
```

# `record`

```elixir
@spec record(t(), integer()) :: t()
```

# `tier`

```elixir
@spec tier(t(), integer()) :: tier()
```

---

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