Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imageTable layers crash when using renderLayerInPanel #24

Open
cadin opened this issue Jul 7, 2024 · 0 comments
Open

imageTable layers crash when using renderLayerInPanel #24

cadin opened this issue Jul 7, 2024 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@cadin
Copy link
Owner

cadin commented Jul 7, 2024

If an imageTable layer is rendered in a custom function with renderLayerInPanel Panels will crash unless you specify a startDelay for the layer.

cntrlPct is nil in this case which causes the crash trying to do the comparison at line 158 in Layers.lua.

elseif layer.animationLoop then
	if layer.visible then
		if layer.trigger then
			if pdButtonJustPressed(layer.trigger) then
				layer.animationLoop.paused = false
			end
		elseif layer.startDelay then
			if layer.startDelayTriggered == nil then
				playdate.timer.performAfterDelay(layer.startDelay, function()
					if layer.animationLoop then layer.animationLoop.paused = false end
				end)
				layer.startDelayTriggered = true
			end
		elseif cntrlPct >= layer.scrollTrigger then -- <-- CRASH HERE
			layer.animationLoop.paused = false
		end
		layer.animationLoop:draw(xPos, yPos)
	end
end

An easy workaround is to set a startDelay on the imageTable layer. It can be set to 0 if no delay is desired.

@cadin cadin added the bug Something isn't working label Jul 7, 2024
@cadin cadin added this to the 2.0 milestone Jul 7, 2024
@cadin cadin self-assigned this Jul 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant