From bba71d11bf16de17acddc4018ab550954c997878 Mon Sep 17 00:00:00 2001 From: Hermes Date: Sat, 8 Aug 2026 22:34:38 +0200 Subject: [PATCH] catalog start(): register Controller driving Navigator over Scroll cards; focus once --- plugin.js | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/plugin.js b/plugin.js index f55187f..75e9c73 100644 --- a/plugin.js +++ b/plugin.js @@ -135,10 +135,29 @@ return html; }; - // Required by ActivitySlide contract. Navigation/focus/scroll are handled by - // the native Lampa.Scroll (it registers its own Controller and auto-scrolls). - // Back (Escape / remote) is handled via the keydown listener in create(). + // Required by ActivitySlide contract. Scroll (created in create()) owns the + // auto-scroll; we register a Controller that drives Navigator over the cards. + // Focus is set on the first card only once (no reset on re-toggle). this.start = function () { + var started = false; + Lampa.Controller.add('content', { + toggle: function () { + var wrap = $('.mymovies'); + var cards = wrap.find('.card.selector'); + if (!cards.length) return; + Lampa.Controller.collectionSet(wrap); + if (!started) { + started = true; + Lampa.Controller.collectionFocus(cards[0], wrap); + } + }, + left: function () { if (Navigator.canmove('left')) Navigator.move('left'); else Lampa.Controller.toggle('menu'); }, + right: function () { Navigator.move('right'); }, + up: function () { Navigator.move('up'); }, + down: function () { Navigator.move('down'); }, + back: function () { Lampa.Activity.backward(); } + }); + Lampa.Controller.toggle('content'); }; // Build each card and append through the native Scroll (handles focus + scroll).