scenario 1: tap on scrollbar area off scrollbar. With the previous commit the app would crash.
scenario 2: drag down a bit, then let go, then drag the scrollbar again. With the previous commit the scrollbar would start again from 0.
Root cause: units mismatch (pixels vs normalized y between 0 and 1)
CMZDG7CJKY4AO2RTV7C54WHUEHYQXDTN57R4Y5ZADZBSLNOOBDFQC
EHKB76GODSP442LYG5Q4HDBA26RHWXFC4Y76ZJL2ERW3RJEBDT7QC
R5QXEHUIZLELJGGCZAE7ATNS3CLRJ7JFRENMGH4XXH24C5WABZDQC
Z5M23NTKKGEACSQJT27DRNS7NEK6OSLR2IOWVAH2C2PRAIU46BIQC
IP4LD33DQFWQ4654YPNJRKQ3CNYSHRZPX6U6ZPY7OLE744XX3MEQC
6DJMOJKEO5DIOEDV655SPA7C7HN2HXWMDJ7UF2CRDRBAF5YO3UEAC
ZM7NOBRMD5HHA35Y4JDC76EOA2RD4KQOQCPURXYKXA6ABMKOJIGQC
compute_scrollbar_topy = function(state)
local f = compute_scrollbar(state)
return state.top + f*(state.bottom - state.top)
end
local sbtop = compute_scrollbar(Current_pane.editor_state)
Current_pane.editor_state.scrollbar_offset = y - sbtop
local sbtopy = compute_scrollbar_topy(Current_pane.editor_state)
Current_pane.editor_state.scrollbar_offset = y - sbtopy
print(y, sbtopy, y-sbtopy)