we have mouse scrolling
This commit is contained in:
parent
164f752338
commit
783146dabc
1 changed files with 7 additions and 2 deletions
|
|
@ -16,6 +16,7 @@ palette = config \
|
||||||
|
|
||||||
dialogPadding = 0;
|
dialogPadding = 0;
|
||||||
|
|
||||||
|
itemGap = 1;
|
||||||
textInputHeight = 40;
|
textInputHeight = 40;
|
||||||
sectionHeight = 30;
|
sectionHeight = 30;
|
||||||
contentWidth = windowWidth - (dialogPadding * 2);
|
contentWidth = windowWidth - (dialogPadding * 2);
|
||||||
|
|
@ -34,8 +35,12 @@ palette = config \
|
||||||
| Item _ \ textInputHeight
|
| Item _ \ textInputHeight
|
||||||
| _ \ 0;
|
| _ \ 0;
|
||||||
|
|
||||||
|
totalHeight = (sum (map itemHeight results)) + itemGap * (len results - 1);
|
||||||
|
|
||||||
itemY = i \ (sum (map itemHeight (take i results))) + i;
|
itemY = i \ (sum (map itemHeight (take i results))) + i;
|
||||||
|
|
||||||
|
onScroll = delta \ paletteState.scrollOffset := max 0 (min (totalHeight - listHeight) (paletteState.scrollOffset + delta.deltaY));
|
||||||
|
|
||||||
scrollTo = index \
|
scrollTo = index \
|
||||||
y = itemY index;
|
y = itemY index;
|
||||||
h = unwrapOr 0 (nth index (map itemHeight results));
|
h = unwrapOr 0 (nth index (map itemHeight results));
|
||||||
|
|
@ -114,9 +119,9 @@ palette = config \
|
||||||
h = listHeight,
|
h = listHeight,
|
||||||
scrollX = 0,
|
scrollX = 0,
|
||||||
scrollY = paletteState.scrollOffset,
|
scrollY = paletteState.scrollOffset,
|
||||||
onScroll = _ \ noOp,
|
onScroll = onScroll,
|
||||||
child = ui.column {
|
child = ui.column {
|
||||||
gap = 1,
|
gap = itemGap,
|
||||||
children = [
|
children = [
|
||||||
...(mapWithIndex (entry i \ entry
|
...(mapWithIndex (entry i \ entry
|
||||||
| Section title \ box {
|
| Section title \ box {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue