From 217f5558de71490e6bda4ded2ae0abf4fe90127b Mon Sep 17 00:00:00 2001 From: James Stuckey Weber Date: Wed, 3 Jan 2024 12:22:23 -0500 Subject: [PATCH 1/2] Fix toggleView, add button --- index.html | 1 + slide-deck.js | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index e3624c5..3d93021 100644 --- a/index.html +++ b/index.html @@ -89,6 +89,7 @@

<button set-view>list<button>

+

Speaker View

diff --git a/slide-deck.js b/slide-deck.js index dc8b5e4..f3d8399 100644 --- a/slide-deck.js +++ b/slide-deck.js @@ -365,14 +365,15 @@ class slideDeck extends HTMLElement { // event handlers toggleView = (to) => { - if (!to) { + let next = to; + if (!next) { const current = this.getAttribute('slide-view'); - const l = slideDeck.slideViews - 1; // adjust for 0-index - const i = slideDeck.slideViews.indexOf(current); - const next = slideDeck.slideViews[(i + 1) % l]; + const l = slideDeck.slideViews.length; + const i = slideDeck.slideViews.indexOf(current) || 0; + next = slideDeck.slideViews[(i + 1) % l]; } - this.setAttribute('slide-view', to || next || 'grid'); + this.setAttribute('slide-view', next || 'grid'); } startEvent = () => { From 74e1d23c30b7a9a70942ec77bfd5aa69c1bccf68 Mon Sep 17 00:00:00 2001 From: James Stuckey Weber Date: Wed, 3 Jan 2024 12:28:28 -0500 Subject: [PATCH 2/2] Move Toggle button into slide-event --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 3d93021..766831b 100644 --- a/index.html +++ b/index.html @@ -82,6 +82,7 @@

<button slide-event>previous<button>

+
@@ -89,7 +90,6 @@

<button set-view>list<button>

-

Speaker View