refactor(datagrid): cell-based sort indicators with native divider behavior#945
refactor(datagrid): cell-based sort indicators with native divider behavior#945
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3437002261
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| repositionIndicators() | ||
| override func viewDidMoveToWindow() { | ||
| super.viewDidMoveToWindow() | ||
| window?.acceptsMouseMovedEvents = true |
There was a problem hiding this comment.
Restore window mouse-move policy when header leaves window
viewDidMoveToWindow unconditionally sets window?.acceptsMouseMovedEvents = true, but this commit never restores the previous value when the header view is removed or replaced. Because acceptsMouseMovedEvents is a window-wide switch (default false), any window that ever hosts this header will continue dispatching mouse-moved events globally, which can introduce unnecessary event traffic and side effects in other views after the grid is gone.
Useful? React with 👍 / 👎.
Summary
Architectural refactor on top of #942 / #944. Replaces the overlay
NSImageViewindicator approach with nativeNSTableHeaderCell-based drawing. Side benefits: cleaner code, working hover cursor on dividers, no spurious sort on divider taps.NSTableHeaderCell: NewSortableHeaderCelloverridesdrawInteriorto render the system ascending/descending arrow at the right edge, with a small priority number to its left for secondary sort columns (Numbers-style).SuppressedSortIndicatorCelldeleted.SortableHeaderViewno longer manages overlay subviews.updateSortIndicatorsnow pushes state into each column'sSortableHeaderCelland triggers a per-column redraw.mouseDowndetects clicks within the column-resize zone and routes them straight tosuper.mouseDown, so AppKit's column-resize handling runs and no sort cycle fires for taps on the divider.mouseMovedsetsNSCursor.resizeLeftRightwhen the pointer is in a resize zone,NSCursor.arrowotherwise. Backed by a.mouseMovedtracking area and aresetCursorRectsregistration.Test plan
↔.2 ↑style indicator.