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