diff --git a/frontend/js/feed.js b/frontend/js/feed.js index f1b27e8..84f7876 100644 --- a/frontend/js/feed.js +++ b/frontend/js/feed.js @@ -653,7 +653,7 @@ App.feed = App.feed || {}; // around whatever video is playing so the reader keeps their place. const rebuildLayout = function() { const keepId = state.feedActiveVideoId; - teardownAllSlides(); + reserveSlides(); const videos = state.loadedVideos || []; let videoIndex = 0; if (keepId != null) { @@ -663,23 +663,66 @@ App.feed = App.feed || {}; state.feedActiveIndex = -1; const step = Math.floor(videoIndex / paneCount()); setActive(step); + releaseReserve(); const scroller = getScroller(); if (scroller) scroller.scrollTop = step * slideHeight(); }; - const teardownAllSlides = function() { + // ------------------------------------------------------------------ + // Reusing panes across a layout change + // + // Splitting or closing a panel changes the stride, so every step is + // renumbered and the slides have to be built again -- but the videos + // haven't changed. A pane already holds one: its