Allow hiding current slide preview in presenter layouts

This commit is contained in:
Dandaedre 2026-11-19 16:33:18 +01:00
parent d171dd51c9
commit 7a2ad988b5
7 changed files with 44 additions and 9 deletions

2
Cargo.lock generated
View File

@ -921,7 +921,7 @@ dependencies = [
[[package]]
name = "pdf-presenter"
version = "0.1.8"
version = "0.1.9"
dependencies = [
"font8x8",
"softbuffer",

View File

@ -4,7 +4,7 @@ default-members = ["crates/pdf-presenter"]
resolver = "3"
[workspace.package]
version = "0.1.8"
version = "0.1.9"
edition = "2024"
license = "MIT"
repository = "https://proxy.dandaedre.com/gitea/idle-org/pdf-presenter"

View File

@ -2,6 +2,14 @@
## Unreleased
### 0.1.9
- Allow hiding the current-slide preview in the HTML concept and saved layouts.
Hiding all previews expands visible notes; presentation status remains visible
in the footer regardless of preview visibility. Existing saved layouts still load.
Validation: JavaScript syntax and 24 Firefox browser checks, including hidden-current
persistence, all-preview space recovery and continued navigation/output status.
### 0.1.8
- Add explicit project/all-project layout saves to the HTML concept using browser

View File

@ -11,15 +11,16 @@ header{flex-wrap:wrap}.toolbar{flex-wrap:wrap}.clock-widget{display:flex;flex-di
main{display:flex;flex-direction:column;min-height:430px;max-width:none}.previews{flex:1;min-height:100px;align-items:stretch;gap:16px}.previews>section{min-width:0;min-height:0;display:flex;flex-direction:column;container-type:inline-size}.previews .slide{flex:1;min-height:0;aspect-ratio:auto;padding:8%;}.slide h1,.next h1{font-size:clamp(15px,8cqw,64px);letter-spacing:-1px;margin:12px 0}.slide .eyebrow{font-size:clamp(7px,2cqw,14px)}.slide p{font-size:clamp(9px,3cqw,20px)}.slide-foot{font-size:clamp(6px,1.5cqw,10px)}.previous-preview .slide{background:#253438;color:#b4c7c9}.notes{flex:0 0 28%;min-height:70px;display:flex;flex-direction:column;margin-top:16px}.note-box{height:auto;min-height:0;flex:1}footer{flex-shrink:0;flex-wrap:wrap;margin-top:14px}#toast{flex-shrink:0}.next-hint{display:none}.caption{flex-wrap:wrap;gap:6px}.notes-tools{flex-wrap:wrap}.layout-panel{position:fixed;right:0;top:0;bottom:0;width:330px;background:#192528;border-left:1px solid #4c6368;z-index:5;padding:24px;overflow:auto;box-shadow:-15px 0 60px #0004}.layout-panel h2{font-size:22px}.layout-panel p{font-size:13px;line-height:1.5;color:var(--muted)}.layout-panel .heading{display:flex;justify-content:space-between;align-items:start}.layout-control{padding:16px 0;border-bottom:1px solid var(--line)}.layout-control>label{display:flex;align-items:center;gap:8px;font-weight:600}.layout-control input[type=checkbox]{accent-color:var(--accent);width:17px;height:17px}.size-control{display:flex;align-items:center;gap:12px;margin-top:12px;color:var(--muted);font-size:12px}.size-control input{min-width:0;width:100%;accent-color:var(--accent)}.size-control output{min-width:44px;text-align:right}.layout-panel .presets{display:flex;gap:6px;flex-wrap:wrap;margin:18px 0}.presets button{font-size:12px;padding:8px}.layout-open header,.layout-open main{margin-right:330px}.layout-panel button.close{padding:5px 9px}.layout-panel small{line-height:1.6;display:block;margin-top:18px}@media(max-width:850px){.layout-open header,.layout-open main{margin-right:0}.layout-panel{width:min(330px,90vw)}.concept{padding:8px 14px}main{padding:14px}.slide .eyebrow,.slide-foot,.slide p{display:none}.toolbar{gap:6px}.toolbar button{padding:8px}.notes{padding:12px}.kbd{display:none}}
.slide-stage{flex:1;min-height:0;display:grid;place-items:center;container-type:size;background:#121c1f;border-radius:10px}.previews .slide-stage .slide{flex:none;width:min(100cqw,calc(100cqh * 16 / 9));height:auto;aspect-ratio:16/9;padding:7%;container-type:inline-size}.slide-stage .slide h1{font-size:clamp(12px,8cqw,64px)}
.layout-save{position:sticky;bottom:-24px;background:#192528;padding:16px 0 24px;border-top:1px solid var(--line);margin-top:18px;display:grid;gap:8px}.layout-save button{font-size:12px}.layout-save p{margin:0;font-size:12px}.project-picker{display:flex;gap:8px;align-items:center}.project-picker select{max-width:180px}
.no-previews .notes{flex:1 1 0!important;margin-top:0}footer #outputBadge{font-size:11px;color:var(--accent)}
</style>
</head>
<body>
<div class="concept"><span><strong>INTERACTIVE CONCEPT</strong> · Mock slides and screens. No real display or system settings change.</span><label class="project-picker">Demo project <select id="demoProject"><option value="ideas">Making room for ideas</option><option value="workshop">Workshop</option></select></label><label>Test setup <select id="topology"><option value="3">3 screens</option><option value="4">4 screens</option><option value="2">Projector disconnected</option><option value="1">Laptop only</option></select></label></div>
<header><span class="brand">P</span><button id="menuButton" aria-expanded="false" aria-controls="menu">☰ Menu</button><div class="doc"><b id="projectTitle">Making room for ideas</b><small>demo.pdf · 12 slides</small></div><div class="toolbar"><button id="displayButton">Displays · 1 → 3</button><button id="blankButton">Blank presentation</button><button id="layoutButton" class="layout-button" aria-controls="layoutPanel" aria-expanded="false">Layout</button><div id="elapsedWidget" class="clock-widget"><small>Elapsed</small><span class="timer" id="timer">00:00</span></div><div id="clockWidget" class="clock-widget"><small>Time</small><span class="timer" id="wallClock">00:00</span></div></div></header>
<nav id="menu" class="menu" aria-label="Presenter menu" hidden><button disabled>Open PDF… <small>Planned</small></button><button disabled>Open picture folder… <small>Planned</small></button><hr><button id="menuDisplays">Displays <small>Assign screens</small></button><button id="menuLayout">Layout <small>Show, hide & resize</small></button><button id="menuSettings">Settings <small>Preview</small></button><hr><button id="resetTimer">Reset timer</button><button id="resetDemo">Reset demo</button></nav>
<main><div class="previews" id="previews"><section id="previousPreview" class="previous-preview"><div class="caption"><span>PREVIOUS</span><span id="previousCount"></span></div><div class="slide"><span class="eyebrow">LOOKING BACK</span><h1 id="previousTitle">Start of presentation</h1><div class="orb"></div></div></section><section id="currentPreview"><div class="caption"><span>CURRENT · <span id="currentCount">1 / 12</span></span><b id="outputBadge">PRESENTATION VISIBLE</b></div><div class="slide"><span class="eyebrow">BEFFROI / FIELD NOTES</span><h1 id="currentTitle">Making room<br>for ideas.</h1><p id="currentSubtitle">A clear view. A little space. A better presentation.</p><div class="orb"></div><span class="slide-foot">DESIGN SESSION · NOVEMBER 2026</span></div></section><section class="next" id="nextPreview"><div class="caption"><span>NEXT</span><span id="nextCount">2 / 12</span></div><div class="slide"><span class="eyebrow">THE STARTING POINT</span><h1 id="nextTitle">Keep the<br>focus.</h1><div class="orb"></div></div><div class="next-hint">Your slides go to <strong id="destination">Screen 3 · Epson projector</strong>.<br>Menus and notes stay on the presenter screen.</div></section></div>
<main><div class="previews" id="previews"><section id="previousPreview" class="previous-preview"><div class="caption"><span>PREVIOUS</span><span id="previousCount"></span></div><div class="slide"><span class="eyebrow">LOOKING BACK</span><h1 id="previousTitle">Start of presentation</h1><div class="orb"></div></div></section><section id="currentPreview"><div class="caption"><span>CURRENT · <span id="currentCount">1 / 12</span></span></div><div class="slide"><span class="eyebrow">BEFFROI / FIELD NOTES</span><h1 id="currentTitle">Making room<br>for ideas.</h1><p id="currentSubtitle">A clear view. A little space. A better presentation.</p><div class="orb"></div><span class="slide-foot">DESIGN SESSION · NOVEMBER 2026</span></div></section><section class="next" id="nextPreview"><div class="caption"><span>NEXT</span><span id="nextCount">2 / 12</span></div><div class="slide"><span class="eyebrow">THE STARTING POINT</span><h1 id="nextTitle">Keep the<br>focus.</h1><div class="orb"></div></div><div class="next-hint">Your slides go to <strong id="destination">Screen 3 · Epson projector</strong>.<br>Menus and notes stay on the presenter screen.</div></section></div>
<section class="notes" id="notesWidget"><div class="caption"><span>PRESENTER NOTES <small> · auto-fit</small></span><div class="notes-tools"><button id="longNotes">Try long notes</button><button id="notesLayout">Resize & visibility</button></div></div><div class="note-box" id="noteBox"><p class="note-text" id="noteText"></p></div></section>
<footer><button id="previous">← Previous</button><button class="primary" id="next">Next →</button><span class="kbd">← → slides · B blank · Esc close menu</span><span class="status" id="routeStatus">Presenter 1 · Presentation 3</span></footer><div id="toast" role="status" aria-live="polite"></div></main>
<footer><button id="previous">← Previous</button><button class="primary" id="next">Next →</button><span class="kbd">← → slides · B blank · Esc close menu</span><b id="outputBadge">PRESENTATION VISIBLE</b><span class="status" id="routeStatus">Presenter 1 · Presentation 3</span></footer><div id="toast" role="status" aria-live="polite"></div></main>
<aside id="layoutPanel" class="layout-panel" aria-labelledby="layoutTitle" hidden>
<div class="heading"><div><h2 id="layoutTitle">Your presenter view</h2><span class="pill">LIVE LAYOUT</span></div><button id="closeLayout" class="close" aria-label="Close layout">✕</button></div>
<p>Keep what helps you speak. Hidden items give their space to the rest. Presentation output stays unchanged.</p>
@ -48,7 +49,7 @@ const emptyLayouts=()=>({version:1,global:null,projects:{}});
function validateLayout(value){
if(!value||typeof value!=='object')throw Error('Invalid layout');
const clean={};
for(const [key,,min,max] of layoutSpecs){const entry=value[key];if(!entry||typeof entry.show!=='boolean'||!Number.isInteger(entry.size)||entry.size<min||entry.size>max||(key==='current'&&!entry.show))throw Error('Invalid layout widget');clean[key]={show:entry.show,size:entry.size};}
for(const [key,,min,max] of layoutSpecs){const entry=value[key];if(!entry||typeof entry.show!=='boolean'||!Number.isInteger(entry.size)||entry.size<min||entry.size>max)throw Error('Invalid layout widget');clean[key]={show:entry.show,size:entry.size};}
return clean;
}
function readLayouts(){
@ -76,12 +77,13 @@ function availableHeight(){const main=document.querySelector('main');main.style.
function applyLayout(){
layoutStatus('Layout changes are not saved until you choose a save scope.');
for(const [key] of layoutSpecs){$(widgets[key]).hidden=!layout[key].show;const toggle=$('show-'+key);if(toggle)toggle.checked=layout[key].show;$('size-'+key).value=layout[key].size;$('size-'+key).disabled=!layout[key].show;$('value-'+key).textContent=layout[key].size+(key==='notes'?'%':['clock','elapsed'].includes(key)?'px':'');}
const noPreviews=!['previous','current','next'].some(k=>layout[k].show);$('previews').hidden=noPreviews;document.querySelector('main').classList.toggle('no-previews',noPreviews);
$('previews').style.gridTemplateColumns=['previous','current','next'].filter(k=>layout[k].show).map(k=>`minmax(0, ${layout[k].size}fr)`).join(' ');
$('notesWidget').style.flexBasis=layout.notes.size+'%';$('timer').style.fontSize=layout.elapsed.size+'px';$('wallClock').style.fontSize=layout.clock.size+'px';availableHeight();fitNotes();
}
function setLayoutOpen(open){$('layoutPanel').hidden=!open;document.body.classList.toggle('layout-open',open);$('layoutButton').setAttribute('aria-expanded',String(open));availableHeight();fitNotes();}
function openLayout(){closeMenu();setLayoutOpen(true);$('closeLayout').focus();}
for(const [key,label,min,max,unit] of layoutSpecs){const row=document.createElement('div');row.className='layout-control';row.innerHTML=`<label>${key==='current'?'':`<input id="show-${key}" type="checkbox" checked>`}${label}</label><div class="size-control"><label for="size-${key}">Size</label><input id="size-${key}" type="range" min="${min}" max="${max}" value="${layout[key].size}" aria-label="${label} size"><output id="value-${key}" for="size-${key}"></output></div>`;$('layoutControls').append(row);if(key!=='current')$('show-'+key).onchange=()=>{layout[key].show=$('show-'+key).checked;applyLayout();};$('size-'+key).oninput=()=>{layout[key].size=Number($('size-'+key).value);applyLayout();};}
for(const [key,label,min,max,unit] of layoutSpecs){const row=document.createElement('div');row.className='layout-control';row.innerHTML=`<label><input id="show-${key}" type="checkbox" checked>${label}</label><div class="size-control"><label for="size-${key}">Size</label><input id="size-${key}" type="range" min="${min}" max="${max}" value="${layout[key].size}" aria-label="${label} size"><output id="value-${key}" for="size-${key}"></output></div>`;$('layoutControls').append(row);$('show-'+key).onchange=()=>{layout[key].show=$('show-'+key).checked;applyLayout();};$('size-'+key).oninput=()=>{layout[key].size=Number($('size-'+key).value);applyLayout();};}
$('layoutButton').onclick=()=>{closeMenu();setLayoutOpen($('layoutPanel').hidden);};$('notesLayout').onclick=openLayout;$('closeLayout').onclick=()=>{setLayoutOpen(false);$('layoutButton').focus();};
$('balancedLayout').onclick=()=>{layout=structuredClone(layoutDefaults);applyLayout();};
$('focusLayout').onclick=()=>{layout=structuredClone(layoutDefaults);for(const k of ['previous','next','notes','elapsed','clock'])layout[k].show=false;applyLayout();};

View File

@ -89,7 +89,7 @@ Depends on usable PDF output and acknowledged displayed-slide state.
- [ ] T16: Show current/next previews, page selection and keyboard controls. Distinguish
requested/preparing/displayed slides and blank state; keep every dialog on presenter.
Let the speaker independently show/hide and resize previous/next previews, notes,
Let the speaker independently show/hide and resize previous/current/next previews, notes,
elapsed time and local HH:MM time. Hidden widgets reclaim space.
Provide explicit project and all-project saves; project layouts override the global
default, with an action to remove the current project override. Keep complete

View File

@ -8,7 +8,7 @@ It is not the native global configuration or a file saved alongside a PDF.
The JSON envelope contains `version: 1`, `global` (null or a layout) and `projects`
(an object mapping the fixed mock project IDs `ideas` and `workshop` to layouts).
Each layout contains `previous`, `current`, `next`, `notes`, `elapsed` and `clock`.
Each widget has a boolean `show` and an integer `size`. Current is always visible.
Each widget has a boolean `show` and an integer `size`. Every widget, including current, can be hidden.
Preview sizes are relative width weights: previous/next 30–160, current 60–200.
Notes size is a height percentage 12–65; elapsed/clock sizes are CSS pixels 16–72.
No document contents, notes, screen assignments or elapsed time are persisted.
@ -28,7 +28,7 @@ Example (a complete all-project default without overrides):
```
Reject unsupported versions, malformed envelopes, missing widgets, wrong types,
non-integer/out-of-range sizes and a hidden current slide. Limit input to 20,000
non-integer/out-of-range sizes. Limit input to 20,000
JavaScript string code units. Ignore unknown fields/project IDs when normalizing.
Failed reads load built-in defaults with a visible status. Failed saves/removals
leave the current view and existing storage untouched; do not report success.
@ -46,3 +46,6 @@ open that copy in an isolated Firefox profile. It displays a PASS/FAIL report an
restores the original storage record. Covers round trips, project/global precedence,
override removal, unsaved changes, unsupported/corrupt records and failed storage.
It is not a native-application or physical-display acceptance test.
Version 1 now accepts `current.show: false`; previously saved layouts remain valid.
With all slide previews hidden, visible notes expand into the released space.

View File

@ -36,6 +36,28 @@ window.addEventListener('load', () => {
layout.notes.size = 55;
restoreLayout();
check(layout.notes.size === 35, 'Unsaved edits are not persisted');
const presentationBefore = JSON.stringify(active);
const nextWidth = $('nextPreview').getBoundingClientRect().width;
$('show-current').checked = false;
$('show-current').dispatchEvent(new Event('change'));
check($('currentPreview').hidden && $('nextPreview').getBoundingClientRect().width > nextWidth, 'Hide current releases space to other previews');
saveLayout('project');
layout = structuredClone(layoutDefaults);
restoreLayout();
check(!layout.current.show && $('currentPreview').hidden, 'Hidden current round-trips in project layout');
saveLayout('global');
check(!readLayouts().global.current.show, 'Hidden current saved in global default');
const noteHeight = $('noteBox').clientHeight;
for (const key of ['previous', 'next']) { layout[key].show = false; }
applyLayout();
check($('previews').hidden && $('noteBox').clientHeight > noteHeight, 'All previews hidden gives space to notes');
check($('outputBadge').getBoundingClientRect().width > 0 && JSON.stringify(active) === presentationBefore, 'Presentation and its status survive hidden previews');
layout.notes.show = false;
applyLayout();
check($('next').getBoundingClientRect().width > 0, 'Navigation remains available with all content hidden');
$('show-current').checked = true;
$('show-current').dispatchEvent(new Event('change'));
check(!$('currentPreview').hidden && !$('previews').hidden, 'Current preview can be restored');
const saved = localStorage.getItem(layoutStorageKey);
Storage.prototype.setItem = () => { throw Error('Quota exceeded'); };
saveLayout('project');