feat(launcher): hero carousel with auto-rotate + manual nav
panels/carousel.lua holds per-module state (index, timer, manual pause, texture cache). Auto-rotate at carousel_interval_seconds (5s default, frontmatter-overrideable). Click on overlay arrows steps and pauses auto-rotate for 30s. Max 7 indicator dots, then 'X / N' overlay (L-Q4). Single-teaser hides the arrows and dots. Zero-teaser falls through to ctx.default_teaser_texture which L.10 ships.
This commit is contained in:
@@ -58,10 +58,13 @@ function M.render(ctx)
|
||||
if not entry then return end
|
||||
local mc = ctx.manifest_cache[entry.id] or { meta = {}, blocks = {} }
|
||||
|
||||
-- Carousel hero placeholder: L.5 swaps this in. For now: a strip.
|
||||
-- Hero carousel (L.5). Renders bg + texture + arrows + dots.
|
||||
-- Zero-teaser modules render the default_teaser_texture (L.10)
|
||||
-- on top of the COLOR_FALLBACK_BG strip.
|
||||
local hero_h = 160
|
||||
if ctx.carousel_state[entry.id] and ctx.carousel_mod then
|
||||
-- L.5 implements this; render call lands later.
|
||||
local s = ctx.carousel_state[entry.id]
|
||||
if s and ctx.carousel_mod then
|
||||
ctx.carousel_mod.render(s, p.x, p.y, p.w, hero_h, ctx.default_teaser_texture)
|
||||
else
|
||||
engine.render.draw_rect(p.x, p.y, p.w, hero_h, 0x404040FF)
|
||||
end
|
||||
@@ -115,7 +118,16 @@ function M.render(ctx)
|
||||
end
|
||||
|
||||
function M.handle_click(ctx, mx, my)
|
||||
-- L.5/L.7 add carousel-arrow + launch-button hit-tests.
|
||||
-- L.5: carousel arrow hit-test. L.7 will add launch-button.
|
||||
if not ctx.selected_entry or ctx.selected_entry == "news" then
|
||||
return false
|
||||
end
|
||||
local entry = find_entry(ctx, ctx.selected_entry)
|
||||
if not entry then return false end
|
||||
local s = ctx.carousel_state[entry.id]
|
||||
if s and ctx.carousel_mod and ctx.carousel_mod.handle_click(s, mx, my) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user