gridview:selectNextRow animation flag doesn't work

Expected: animation should be skipped when running the gridview class method selectNextRow with animate set to false.

Observed: the gridview animates regardless of the value of the animate argument.

This bug affects the simulator (on mac) and hardware.

Here is a single-file Playdate game that reproduces the bug:

import "CoreLibs/ui"
import "CoreLibs/graphics"
import "CoreLibs/timer"

local gfx <const> = playdate.graphics

local menuOptions = {"Sword", "Shield", "Arrow", "Sling", "Stone", "Longbow", "MorningStar", "Armour", "Dagger", "Rapier", "Skeggox", "War Hammer", "Battering Ram", "Catapult"}
local listview = playdate.ui.gridview.new(0, 20)
listview:setNumberOfRows(#menuOptions)
listview:setCellPadding(0, 0, 13, 10)
listview:setContentInset(24, 24, 13, 11)

function listview:drawCell(section, row, column, selected, x, y, width, height)
        if selected then
                gfx.fillRoundRect(x, y, width, 20, 4)
                gfx.setImageDrawMode(gfx.kDrawModeFillWhite)
                gfx.setColor(gfx.kColorWhite)
        else
                gfx.setColor(gfx.kColorBlack)
                gfx.setImageDrawMode(gfx.kDrawModeCopy)
        end
        gfx.drawTextInRect(menuOptions[row], x, y+2, width, height, nil, "...", kTextAlignment.center)
end

local animated = true
function scroll_position()
  
  listview:selectNextRow(true, true, animated)
    
  playdate.timer.performAfterDelay(100, function()
    scroll_position()
  end)
end

scroll_position()


function playdate.update()
    
    gfx.clear()
  
    listview:drawInRect(220, 20, 160, 210)
    
    gfx.drawText('Animated: '..tostring(animated), 20, 60)
    gfx.drawText('Press Ⓐ to change', 20, 100)
    playdate.drawFPS(0,0)

    playdate.timer:updateTimers()
end

function playdate.AButtonDown()
  animated = not animated
end
1 Like

It's worth noting that setting setScrollDuration to 0 will achieve this instead, in the mean time.

1 Like

Yup, it's a bug. We'll get it fixed. Thanks!

1 Like

Thanks Dan! Hope it’s an easy one!

1 Like