Implement per-pixel smooth scrolling for ListView

- Changed BrowserScrollOffset and ListView.ScrollOffset from int (row index)
  to ui.Dp (pixel offset) for smooth per-pixel scrolling
- Updated HandleBrowserScroll to use raw Dp delta instead of row-based
  scrolling with minimum ±1 row jumps
- Fixed search not triggering new frames by detecting query changes in
  main.go FrameEvent handler
- Fixed click misalignment by indexing RowFilenames with local index i
  instead of rowGlobalIndex
- Fixed bottom clamping using actual BrowserListHeight and corrected
  formula: maxScroll = totalRows * rowHeight - BrowserListHeight
This commit is contained in:
gmp
2026-05-28 16:14:11 -04:00
parent 23fdeabad4
commit 8f185341b3
3 changed files with 56 additions and 29 deletions
+7
View File
@@ -59,6 +59,13 @@ func run(w *app.Window) error {
currentElems := elems
renderer.Draw(gtx, currentElems)
logic.DisplayLineChan() <- int(renderer.LastLineY())
// Check for search query change — trigger a new frame if the
// widget.Editor text differs from the logic's stored query.
// This ensures the filtered list updates as the user types.
newQuery := logic.State().SearchEditor.Text()
if newQuery != logic.State().SearchQuery {
logic.InputChan() <- []ui.InputEvent{}
}
if events := renderer.CheckGestures(e.Source, gtx.Metric); len(events) > 0 {
logic.InputChan() <- events
}