we have mouse scrolling

This commit is contained in:
Dustin Swan 2026-02-13 17:37:03 -07:00
parent 164f752338
commit 783146dabc
No known key found for this signature in database
GPG key ID: 30D46587E2100467

View file

@ -16,6 +16,7 @@ palette = config \
dialogPadding = 0;
itemGap = 1;
textInputHeight = 40;
sectionHeight = 30;
contentWidth = windowWidth - (dialogPadding * 2);
@ -34,8 +35,12 @@ palette = config \
| Item _ \ textInputHeight
| _ \ 0;
totalHeight = (sum (map itemHeight results)) + itemGap * (len results - 1);
itemY = i \ (sum (map itemHeight (take i results))) + i;
onScroll = delta \ paletteState.scrollOffset := max 0 (min (totalHeight - listHeight) (paletteState.scrollOffset + delta.deltaY));
scrollTo = index \
y = itemY index;
h = unwrapOr 0 (nth index (map itemHeight results));
@ -114,9 +119,9 @@ palette = config \
h = listHeight,
scrollX = 0,
scrollY = paletteState.scrollOffset,
onScroll = _ \ noOp,
onScroll = onScroll,
child = ui.column {
gap = 1,
gap = itemGap,
children = [
...(mapWithIndex (entry i \ entry
| Section title \ box {