Fix scrolling / update race condition
This commit is contained in:
@@ -731,6 +731,7 @@ local function runScrollableGrid(options)
|
||||
local targetScrollRow = 0
|
||||
local refreshTimer
|
||||
local animationTimer
|
||||
local pendingCacheSync = false
|
||||
|
||||
local columns = 6
|
||||
local rowsPerView = 6
|
||||
@@ -902,13 +903,23 @@ local function runScrollableGrid(options)
|
||||
|
||||
persistScrollState()
|
||||
renderGrid()
|
||||
|
||||
if not animationTimer and pendingCacheSync then
|
||||
pendingCacheSync = false
|
||||
syncFromCache()
|
||||
renderGrid()
|
||||
end
|
||||
elseif event == "timer" then
|
||||
local handled, isDone = stepGlobalCountRefresh(p1)
|
||||
|
||||
if handled and isDone then
|
||||
if animationTimer or math.abs(targetScrollRow - currentScrollRow) > 0.001 then
|
||||
pendingCacheSync = true
|
||||
else
|
||||
syncFromCache()
|
||||
renderGrid()
|
||||
end
|
||||
end
|
||||
elseif event == "monitor_touch" and p1 == monName then
|
||||
if options.handleChromeTouch and options.handleChromeTouch(x, y) then
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user