You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`TerminalView` used a standalone `NSScroller`. An overlay `NSScroller`
does not manage its own presentation in the same way as a scroller
that belongs to an `NSScrollView`.
The earlier implementation had these problems:
- The legacy scrollbar used permanent horizontal space.
- The overlay scrollbar did not reliably appear during scrolling.
- The scrollbar could not be dragged.
- The custom indicator used a different coordinate system from `NSScroller`.
- The custom indicator was thicker than the small platform scrollbar.
The new implementation addresses these problems.
`TerminalView` now owns two related views:
- `TerminalScroller` is an `NSScroller`. It handles pointer tracking and drag events.
- `OverlayScrollerIndicator` draws the visible overlay knob above terminal content.
The native scroller stays transparent in overlay mode. It remains
available for hit testing and drag tracking. The custom indicator does
not accept pointer events.
The default style is `.overlay`.
- It does not reduce the terminal width.
- It appears when wheel or programmatic scrolling changes the position.
- It remains visible while the user holds and drags the knob.
- It starts a 1.5-second hide delay after scrolling or drag release.
- It fades for 0.25 seconds.
- It hides without motion when Reduce Motion is enabled.
The existing `.legacy` style remains available as an opt-in style. It
reserves its normal width.
`NSScroller` uses flipped coordinates. The custom indicator initially
used standard `NSView` coordinates. The visual code therefore needed
an inversion, but that inversion made native drag tracking move in the
wrong direction.
`OverlayScrollerIndicator.isFlipped` is now `true`. The indicator and
scroller use the same coordinate system. The code can use the terminal
scroll position directly:
```swift
scroller.doubleValue = state.doubleValue
scroll(toPosition: scroller.doubleValue)
```
This also restores the standard page directions:
- `.decrementPage` calls `pageUp()`.
- `.incrementPage` calls `pageDown()`.
Overlay mode uses `NSControl.ControlSize.small`. AppKit then supplies
a four-point-wide knob and a 15-point interaction area. Legacy mode
continues to use the regular control size.
The terminal view sends pointer events in the visible overlay region
directly to `TerminalScroller`. This is necessary because the native
scroller has an alpha value of zero in overlay mode.
The custom indicator stays above both the native scroller and the
Metal rendering view. This prevents the renderer from covering it.
0 commit comments