Relecture de la V0.2a (09/10) : la rénovation se joue en diaporama
Retour de Jules : « c'est une sorte de vidéo en diapositive […] je le présenterais plutôt comme ça qu'une planche avec 20 vues ». L'étape 12 sort chaque vue seule (reno-01 à reno-20, en -m) au lieu de la planche contact et des vues 1 et 20 ; planches.md prend `reno-*` (toutes les vues, dans l'ordre) et le mur joue la pièce en place, en fondu, en boucle, avec pause, vue précédente et suivante (flèches du clavier, toucher). Les fiches paille et « on isole ensemble » ouvrent le diaporama. Le plateau peut déborder d'un cinquième de la vue, pour qu'une pièce posée au bord de la table se centre. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018npeWpNDNRy36bosAVhYqV
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 79 KiB |
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 81 KiB |
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 87 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 90 KiB |
|
Before Width: | Height: | Size: 321 KiB |
|
Before Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 256 KiB |
|
Before Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 416 KiB |
|
Before Width: | Height: | Size: 148 KiB |
|
Before Width: | Height: | Size: 19 KiB |
@@ -134,19 +134,104 @@
|
||||
938,
|
||||
0
|
||||
],
|
||||
"reno-avant": [
|
||||
3170,
|
||||
1934,
|
||||
1
|
||||
"reno-01": [
|
||||
1600,
|
||||
976,
|
||||
0
|
||||
],
|
||||
"reno-apres": [
|
||||
3170,
|
||||
1934,
|
||||
1
|
||||
"reno-02": [
|
||||
1600,
|
||||
976,
|
||||
0
|
||||
],
|
||||
"reno-sequence": [
|
||||
3300,
|
||||
1792,
|
||||
1
|
||||
"reno-03": [
|
||||
1600,
|
||||
976,
|
||||
0
|
||||
],
|
||||
"reno-04": [
|
||||
1600,
|
||||
976,
|
||||
0
|
||||
],
|
||||
"reno-05": [
|
||||
1600,
|
||||
976,
|
||||
0
|
||||
],
|
||||
"reno-06": [
|
||||
1600,
|
||||
976,
|
||||
0
|
||||
],
|
||||
"reno-07": [
|
||||
1600,
|
||||
976,
|
||||
0
|
||||
],
|
||||
"reno-08": [
|
||||
1600,
|
||||
976,
|
||||
0
|
||||
],
|
||||
"reno-09": [
|
||||
1600,
|
||||
976,
|
||||
0
|
||||
],
|
||||
"reno-10": [
|
||||
1600,
|
||||
976,
|
||||
0
|
||||
],
|
||||
"reno-11": [
|
||||
1600,
|
||||
976,
|
||||
0
|
||||
],
|
||||
"reno-12": [
|
||||
1600,
|
||||
976,
|
||||
0
|
||||
],
|
||||
"reno-13": [
|
||||
1600,
|
||||
976,
|
||||
0
|
||||
],
|
||||
"reno-14": [
|
||||
1600,
|
||||
976,
|
||||
0
|
||||
],
|
||||
"reno-15": [
|
||||
1600,
|
||||
976,
|
||||
0
|
||||
],
|
||||
"reno-16": [
|
||||
1600,
|
||||
976,
|
||||
0
|
||||
],
|
||||
"reno-17": [
|
||||
1600,
|
||||
976,
|
||||
0
|
||||
],
|
||||
"reno-18": [
|
||||
1600,
|
||||
976,
|
||||
0
|
||||
],
|
||||
"reno-19": [
|
||||
1600,
|
||||
976,
|
||||
0
|
||||
],
|
||||
"reno-20": [
|
||||
1600,
|
||||
976,
|
||||
0
|
||||
]
|
||||
}
|
||||
@@ -48,9 +48,10 @@ export function creerMur({ $, PLANCHES, DOCS, IMG, reduit, couleur, encre, SYSTE
|
||||
const M = PLANCHES.murs[id]; E.mur = id;
|
||||
const { pieces, W, H } = disposer(M.pieces);
|
||||
E.pieces = pieces; P.taille(W, H);
|
||||
el.innerHTML = pieces.map(({ p, x, y, w, h }, i) => `<figure class="piece" data-i="${i}" style="left:${x}px;top:${y}px;width:${w}px">
|
||||
el.innerHTML = pieces.map(({ p, x, y, w, h }, i) => `<figure class="piece${p.suite ? ' dia' : ''}" data-i="${i}" style="left:${x}px;top:${y}px;width:${w}px">
|
||||
<img src="${IMG[p.image + '-m']}" alt="${p.titre}" style="height:${h}px" ${DOCS[p.image][2] ? `data-g="${IMG[p.image + '-g']}"` : ''} draggable="false">
|
||||
<figcaption style="font-size:${i ? 22 : 26}px"><b>${p.titre}</b><span>${p.source}</span></figcaption></figure>`).join('');
|
||||
${p.suite ? `<img class="dia-b" alt="" style="height:${h}px" draggable="false"><span class="dia-jouer" aria-hidden="true" style="top:${Math.round(h / 2 - 60)}px"></span>` : ''}
|
||||
<figcaption style="font-size:${i ? 22 : 26}px"><b>${p.titre}</b><span>${p.source}${p.suite ? ` · ${p.suite.length} vues` : ''}</span></figcaption></figure>`).join('');
|
||||
$('m-titre').textContent = M.titre;
|
||||
const suites = (SUITES[id] || []).filter(([type, cible]) => type === 'lecteur' || PLANCHES.murs[cible]);
|
||||
$('m-vignettes').innerHTML = pieces.map(({ p }, i) => `<button type="button" data-i="${i}" aria-label="${p.titre}"><img src="${IMG[p.image + '-p']}" alt=""></button>`).join('')
|
||||
@@ -69,9 +70,46 @@ export function creerMur({ $, PLANCHES, DOCS, IMG, reduit, couleur, encre, SYSTE
|
||||
el.querySelectorAll('img[data-g]').forEach((im) => { if (im.width * P.C.s * dpr > 1700) { im.src = im.dataset.g; im.removeAttribute('data-g'); } });
|
||||
});
|
||||
}
|
||||
// ---- le diaporama (09/10, Jules : « une sorte de vidéo en diapositive ») : la pièce se joue en place, vue après vue,
|
||||
// en fondu ; elle part seule quand on s'en approche, s'arrête quand on en quitte, et tourne en boucle.
|
||||
const DIA = { i: -1, k: 0, joue: false, t: 0 };
|
||||
const PAUSE = (k, n) => (k === 0 ? 2200 : k === n - 1 ? 3200 : 1500); // on s'attarde sur l'avant et sur l'après
|
||||
function diaVue(k) {
|
||||
const c = E.pieces[DIA.i]; if (!c) return; const n = c.p.suite.length; DIA.k = (k + n) % n;
|
||||
const f = el.querySelector(`.piece[data-i="${DIA.i}"]`), [a, b] = f.querySelectorAll('img'), url = IMG[c.p.suite[DIA.k] + '-m'];
|
||||
// deux images superposées : la seconde apparaît en fondu sur la première, puis s'efface sur la suivante chargée dessous
|
||||
const bOn = b.classList.contains('on'), cible = bOn ? a : b;
|
||||
cible.src = url;
|
||||
const montre = () => b.classList.toggle('on', !bOn);
|
||||
(cible.decode ? cible.decode() : Promise.resolve()).then(montre, montre);
|
||||
const s = $('m-piece').querySelector('.dia-n'); if (s) s.textContent = `vue ${DIA.k + 1} / ${n}`;
|
||||
const g = $('m-piece').querySelector('.dia-barre i'); if (g) g.style.width = `${((DIA.k + 1) / n) * 100}%`;
|
||||
new Image().src = IMG[c.p.suite[(DIA.k + 1) % n] + '-m']; // la suivante est déjà là quand vient son tour
|
||||
}
|
||||
function diaJouer(on) {
|
||||
clearTimeout(DIA.t); DIA.joue = on && DIA.i >= 0;
|
||||
const b = $('m-piece').querySelector('[data-a="jouer"]');
|
||||
if (b) { b.textContent = DIA.joue ? 'Pause' : 'Lecture'; b.setAttribute('aria-pressed', String(DIA.joue)); }
|
||||
el.querySelector(`.piece[data-i="${DIA.i}"]`)?.classList.toggle('joue', DIA.joue);
|
||||
if (!DIA.joue) return;
|
||||
const n = E.pieces[DIA.i].p.suite.length;
|
||||
const pas = () => { DIA.t = setTimeout(() => { diaVue(DIA.k + 1); pas(); }, PAUSE(DIA.k, n)); };
|
||||
pas();
|
||||
}
|
||||
function diaQuitter() { diaJouer(false); DIA.i = -1; }
|
||||
|
||||
function legende(i) {
|
||||
if (DIA.i !== i) diaQuitter();
|
||||
E.active = i; const q = E.pieces[i]?.p;
|
||||
$('m-piece').innerHTML = q ? `<b>${q.titre}</b><small>${q.source}</small>${q.fil ? `<button type="button" class="vers-fil" style="--b:${encre(q.fil)}">Sur la planche 2 : ${SYSTEMES[q.fil].titre.toLowerCase()} →</button>` : ''}` : '';
|
||||
if (q?.suite) {
|
||||
$('m-piece').insertAdjacentHTML('beforeend', `<div class="dia-ctl"><button type="button" data-a="prec" aria-label="Vue précédente">‹</button><button type="button" data-a="jouer" aria-pressed="false">Lecture</button><button type="button" data-a="suiv" aria-label="Vue suivante">›</button><span class="dia-n" aria-live="polite"></span></div><div class="dia-barre"><i></i></div>`);
|
||||
$('m-piece').querySelector('[data-a="prec"]').addEventListener('click', () => { diaJouer(false); diaVue(DIA.k - 1); });
|
||||
$('m-piece').querySelector('[data-a="suiv"]').addEventListener('click', () => { diaJouer(false); diaVue(DIA.k + 1); });
|
||||
$('m-piece').querySelector('[data-a="jouer"]').addEventListener('click', () => diaJouer(!DIA.joue));
|
||||
if (DIA.i !== i) { DIA.i = i; DIA.k = 0; }
|
||||
diaVue(DIA.k);
|
||||
}
|
||||
const bf = $('m-piece').querySelector('.vers-fil'); if (bf) bf.addEventListener('click', () => { fermer(false); onLecteur(q.fil); });
|
||||
$('m-vignettes').querySelectorAll('button[data-i]').forEach((b) => b.setAttribute('aria-current', String(+b.dataset.i === i)));
|
||||
el.querySelectorAll('.piece').forEach((f) => f.classList.toggle('active', +f.dataset.i === i));
|
||||
@@ -80,10 +118,12 @@ export function creerMur({ $, PLANCHES, DOCS, IMG, reduit, couleur, encre, SYSTE
|
||||
const c = E.pieces[i]; if (!c) return; legende(i);
|
||||
if (zone) { const [x0, y0, x1, y1] = zone; P.cadrer(c.x + x0 * c.w, c.y + y0 * c.h, c.x + x1 * c.w, c.y + y1 * c.h, duree, 0.03); }
|
||||
else P.cadrer(c.x, c.y, c.x + c.w, c.y + c.h + LEG, duree, 0.04);
|
||||
if (c.p.suite && !reduit) diaJouer(true);
|
||||
}
|
||||
function toucher(x, y) {
|
||||
const i = E.pieces.findIndex((c) => x >= c.x && x <= c.x + c.w && y >= c.y && y <= c.y + c.h + LEG);
|
||||
if (i >= 0) montrer(i);
|
||||
if (i >= 0 && i === DIA.i) diaJouer(!DIA.joue); // toucher le diaporama qu'on regarde : pause, ou reprise
|
||||
else if (i >= 0) montrer(i);
|
||||
}
|
||||
function ouvrir(id, pieceId = null, zone = null) {
|
||||
if (!PLANCHES.murs[id]) return;
|
||||
@@ -96,8 +136,13 @@ export function creerMur({ $, PLANCHES, DOCS, IMG, reduit, couleur, encre, SYSTE
|
||||
$('m-retour').focus();
|
||||
history.replaceState(null, '', `#planche-${id}`);
|
||||
}
|
||||
function fermer(rappel = true) { $('mur').hidden = true; if (rappel) onFermer(); }
|
||||
function fermer(rappel = true) { diaQuitter(); $('mur').hidden = true; if (rappel) onFermer(); }
|
||||
$('m-retour').addEventListener('click', () => fermer());
|
||||
addEventListener('keydown', (e) => { if (e.key === 'Escape' && !$('mur').hidden) fermer(); });
|
||||
addEventListener('keydown', (e) => {
|
||||
if ($('mur').hidden) return;
|
||||
if (e.key === 'Escape') fermer();
|
||||
else if (DIA.i >= 0 && (e.key === 'ArrowRight' || e.key === 'ArrowLeft')) { diaJouer(false); diaVue(DIA.k + (e.key === 'ArrowRight' ? 1 : -1)); }
|
||||
else if (DIA.i >= 0 && e.key === ' ' && !e.target.closest('button')) { e.preventDefault(); diaJouer(!DIA.joue); }
|
||||
});
|
||||
return { ouvrir, fermer };
|
||||
}
|
||||
|
||||
@@ -5,10 +5,11 @@ export function creerPlateau(vp, el, { W, H, reduit, max = 2.5, onBouge = () =>
|
||||
const applique = () => { el.style.transform = `translate(${C.x}px, ${C.y}px) scale(${C.s})`; onBouge(C); };
|
||||
const ajuste = () => { const r = vp.getBoundingClientRect(); return Math.min(r.width / C.W, r.height / C.H); };
|
||||
const mini = () => ajuste() * 0.9;
|
||||
// la table peut déborder d'un cinquième de la vue : une pièce posée au bord se centre quand on s'en approche (09/10)
|
||||
function borne(o, r) {
|
||||
const w = C.W * o.s, h = C.H * o.s;
|
||||
o.x = w >= r.width ? Math.min(0, Math.max(r.width - w, o.x)) : (r.width - w) / 2;
|
||||
o.y = h >= r.height ? Math.min(0, Math.max(r.height - h, o.y)) : (r.height - h) / 2;
|
||||
const w = C.W * o.s, h = C.H * o.s, mx = r.width * 0.2, my = r.height * 0.2;
|
||||
o.x = w >= r.width ? Math.min(mx, Math.max(r.width - w - mx, o.x)) : (r.width - w) / 2;
|
||||
o.y = h >= r.height ? Math.min(my, Math.max(r.height - h - my, o.y)) : (r.height - h) / 2;
|
||||
return o;
|
||||
}
|
||||
function viser(x, y, s, duree = 900) {
|
||||
|
||||
@@ -149,6 +149,21 @@ body.menu-ouvert #fiches { display: none; }
|
||||
.plateau.mur .piece { position: absolute; margin: 0; }
|
||||
.plateau.mur .piece img { display: block; width: 100%; background: #fff; box-shadow: 0 6px 22px rgba(16, 42, 58, .16); border-radius: 4px; user-select: none; -webkit-user-drag: none; pointer-events: none; }
|
||||
.plateau.mur .piece.active img { outline: 6px solid var(--c, var(--encre)); outline-offset: 6px; }
|
||||
/* le diaporama de la rénovation : deux vues superposées en fondu, un bouton de lecture tant qu'il ne joue pas */
|
||||
.plateau.mur .piece.dia { background: #000; }
|
||||
.plateau.mur .piece.dia img { background: #000; }
|
||||
.plateau.mur .piece.dia img.dia-b { position: absolute; left: 0; top: 0; width: 100%; opacity: 0; transition: opacity .35s ease; box-shadow: none; }
|
||||
.plateau.mur .piece.dia img.dia-b.on { opacity: 1; }
|
||||
.plateau.mur .piece.dia figcaption { background: var(--papier, #fffdf6); padding-top: 14px; margin-top: 0; }
|
||||
.dia-jouer { position: absolute; left: 50%; top: 0; width: 120px; height: 120px; margin-left: -60px; border-radius: 50%; background: rgba(255, 253, 246, .9); pointer-events: none; transition: opacity .3s; }
|
||||
.dia-jouer::after { content: ''; position: absolute; left: 46px; top: 34px; border-style: solid; border-width: 26px 0 26px 40px; border-color: transparent transparent transparent var(--c-encre, #102a3a); }
|
||||
.piece.dia.joue .dia-jouer { opacity: 0; }
|
||||
.dia-ctl { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
|
||||
.dia-ctl button { min-width: 40px; min-height: 36px; border: 1px solid var(--c-encre, var(--encre)); border-radius: 9px; background: #fff; color: var(--c-encre, var(--encre)); font: 600 14px/1 inherit; font-family: inherit; padding: 0 10px; cursor: pointer; }
|
||||
.dia-ctl button[data-a="jouer"] { min-width: 84px; background: var(--c-encre, var(--encre)); color: #fff; }
|
||||
.dia-n { font-size: 13px; color: var(--encre-2); margin-left: 4px; font-variant-numeric: tabular-nums; }
|
||||
.dia-barre { height: 3px; margin-top: 6px; background: rgba(16, 42, 58, .12); border-radius: 2px; overflow: hidden; }
|
||||
.dia-barre i { display: block; height: 100%; width: 0; background: var(--c-encre, var(--encre)); transition: width .3s; }
|
||||
.plateau.mur figcaption { margin-top: 14px; line-height: 1.25; color: var(--encre); max-width: 60ch; }
|
||||
.plateau.mur figcaption b { display: block; font-weight: 600; }
|
||||
.plateau.mur figcaption span { display: block; color: var(--encre-2); font-size: .8em; }
|
||||
|
||||