Checkpoint nav (03/11) : visite guidée active au bureau en résumé, bouton pause caché quand rien ne joue, zone sûre du bas comptée dans le plein, cibles ≥ 40 px, libellés S·M·XL depuis nav.ts
This commit is contained in:
+10
-5
@@ -32,7 +32,7 @@ import { creerMur } from './mur.js';
|
|||||||
import { creerCarte } from './carte.js';
|
import { creerCarte } from './carte.js';
|
||||||
import { picto, COULEURS } from './pictos.js';
|
import { picto, COULEURS } from './pictos.js';
|
||||||
import { lireModeV0 } from './mode.ts';
|
import { lireModeV0 } from './mode.ts';
|
||||||
import { ANCRES, BARRE, BUREAU_MIN, echelleDe, etatCamera, etatDepart, etatSuivant, finDefilement, hauteurBandeau, ongletsDe, parcoursActif, SEUIL_TIRAGE, tirage } from './nav.ts';
|
import { ANCRES, BARRE, BUREAU_MIN, LIBELLES, echelleDe, etatCamera, etatDepart, etatSuivant, finDefilement, hauteurBandeau, ongletsDe, parcoursActif, SEUIL_TIRAGE, tirage } from './nav.ts';
|
||||||
|
|
||||||
const $ = (id) => document.getElementById(id);
|
const $ = (id) => document.getElementById(id);
|
||||||
const nomDe = (k) => k.split('/').pop().replace(/\.(png|jpg)$/, '');
|
const nomDe = (k) => k.split('/').pop().replace(/\.(png|jpg)$/, '');
|
||||||
@@ -109,7 +109,8 @@ function creerBandeau(sec, { nom, contenu, changer }) {
|
|||||||
const poignee = sec.querySelector('.poignee'), corps = sec.querySelector('.corps');
|
const poignee = sec.querySelector('.poignee'), corps = sec.querySelector('.corps');
|
||||||
const B = {
|
const B = {
|
||||||
etat: sec.dataset.etat,
|
etat: sec.dataset.etat,
|
||||||
hauteur: (e = B.etat) => hauteurBandeau(e, innerHeight, bureau(), { contenu: e === 'resume' ? contenu() : undefined, haut: hautLibre() }),
|
// `haut` compte la zone sûre du bas : le CSS l'ajoute à la hauteur, le plein doit donc s'arrêter d'autant plus bas (iPhone à barre d'accueil)
|
||||||
|
hauteur: (e = B.etat) => hauteurBandeau(e, innerHeight, bureau(), { contenu: e === 'resume' ? contenu() : undefined, haut: hautLibre() + B.safe() }),
|
||||||
safe: () => (bureau() ? 0 : parseFloat(getComputedStyle(sec).paddingBottom) || 0),
|
safe: () => (bureau() ? 0 : parseFloat(getComputedStyle(sec).paddingBottom) || 0),
|
||||||
majH: () => document.documentElement.style.setProperty(nom, `${B.hauteur()}px`),
|
majH: () => document.documentElement.style.setProperty(nom, `${B.hauteur()}px`),
|
||||||
poser(n, force = false) {
|
poser(n, force = false) {
|
||||||
@@ -132,7 +133,7 @@ function creerBandeau(sec, { nom, contenu, changer }) {
|
|||||||
tir.dy = e.clientY - tir.y;
|
tir.dy = e.clientY - tir.y;
|
||||||
if (Math.abs(tir.dy) < 6 && !sec.classList.contains('tire')) return;
|
if (Math.abs(tir.dy) < 6 && !sec.classList.contains('tire')) return;
|
||||||
sec.classList.add('tire');
|
sec.classList.add('tire');
|
||||||
document.documentElement.style.setProperty(nom, `${Math.max(BARRE, Math.min(innerHeight - hautLibre(), tir.h - tir.dy))}px`);
|
document.documentElement.style.setProperty(nom, `${Math.max(BARRE, Math.min(innerHeight - hautLibre() - B.safe(), tir.h - tir.dy))}px`);
|
||||||
});
|
});
|
||||||
const lacher = (e) => {
|
const lacher = (e) => {
|
||||||
if (!tir || e.pointerId !== tir.id) return;
|
if (!tir || e.pointerId !== tir.id) return;
|
||||||
@@ -161,6 +162,7 @@ const bandeau = creerBandeau($('fiches'), {
|
|||||||
contenu: () => { const c = $('f-corps'), p = c.querySelector('.pied'); return p.getBoundingClientRect().bottom - c.getBoundingClientRect().top + c.scrollTop + 12 + 42; },
|
contenu: () => { const c = $('f-corps'), p = c.querySelector('.pied'); return p.getBoundingClientRect().bottom - c.getBoundingClientRect().top + c.scrollTop + 12 + 42; },
|
||||||
changer(n, avant) {
|
changer(n, avant) {
|
||||||
document.body.classList.toggle('bandeau-plein', n === 'plein');
|
document.body.classList.toggle('bandeau-plein', n === 'plein');
|
||||||
|
$('b-lecture').hidden = !parcoursActif(n, bureau()); // rien ne joue quand le texte attend : pas de bouton « pause »
|
||||||
majPoignee();
|
majPoignee();
|
||||||
if (etatCamera(n) !== etatCamera(avant)) recadrer();
|
if (etatCamera(n) !== etatCamera(avant)) recadrer();
|
||||||
},
|
},
|
||||||
@@ -221,7 +223,10 @@ function allerEchelle(e) {
|
|||||||
else if (surCarte) versQuartier(ANCRES[e]);
|
else if (surCarte) versQuartier(ANCRES[e]);
|
||||||
else if (T3) T3.cadrer(ANCRES[e], 1600, true);
|
else if (T3) T3.cadrer(ANCRES[e], 1600, true);
|
||||||
}
|
}
|
||||||
document.querySelectorAll('#echelle button').forEach((b) => b.addEventListener('click', () => allerEchelle(b.dataset.echelle)));
|
document.querySelectorAll('#echelle button').forEach((b) => {
|
||||||
|
const e = b.dataset.echelle; b.title = LIBELLES[e]; b.setAttribute('aria-label', `${e}, ${LIBELLES[e]}`); // les libellés longs viennent de nav.ts (N1)
|
||||||
|
b.addEventListener('click', () => allerEchelle(e));
|
||||||
|
});
|
||||||
|
|
||||||
// Les onglets : les chapitres de l'échelle active (nav.ts ongletsDe), et toujours celui de la fiche courante.
|
// Les onglets : les chapitres de l'échelle active (nav.ts ongletsDe), et toujours celui de la fiche courante.
|
||||||
function onglets(f) {
|
function onglets(f) {
|
||||||
@@ -314,7 +319,7 @@ function majLecture() {
|
|||||||
requestAnimationFrame(tic);
|
requestAnimationFrame(tic);
|
||||||
if (!$('cycle').hidden || !$('mur').hidden || !$('etape-carte').hidden) { E.t0 = now; return; }
|
if (!$('cycle').hidden || !$('mur').hidden || !$('etape-carte').hidden) { E.t0 = now; return; }
|
||||||
// replié, la visite guidée continue ; déplié, le texte attend (nav.ts PAUSE_DEPLIE)
|
// replié, la visite guidée continue ; déplié, le texte attend (nav.ts PAUSE_DEPLIE)
|
||||||
if (!parcoursActif(bandeau.etat)) { E.t0 = now; $('temps').style.width = '0%'; return; }
|
if (!parcoursActif(bandeau.etat, bureau())) { E.t0 = now; $('temps').style.width = '0%'; return; }
|
||||||
const actif = E.lecture && now > E.pause && !E.mini;
|
const actif = E.lecture && now > E.pause && !E.mini;
|
||||||
if (!actif) { $('temps').style.width = '0%'; if (now <= E.pause) E.t0 = now; return; }
|
if (!actif) { $('temps').style.width = '0%'; if (now <= E.pause) E.t0 = now; return; }
|
||||||
const k = (now - E.t0) / DUREE; $('temps').style.width = Math.min(100, k * 100) + '%';
|
const k = (now - E.t0) / DUREE; $('temps').style.width = Math.min(100, k * 100) + '%';
|
||||||
|
|||||||
+2
-1
@@ -96,7 +96,8 @@ export function hauteurBandeau(etat: Etat, innerHeight: number, bureau: boolean,
|
|||||||
|
|
||||||
/** Replié, la visite guidée continue ; déplié, je lis (N8). */
|
/** Replié, la visite guidée continue ; déplié, je lis (N8). */
|
||||||
export const PAUSE_DEPLIE = true;
|
export const PAUSE_DEPLIE = true;
|
||||||
export const parcoursActif = (etat: Etat): boolean => !PAUSE_DEPLIE || etat === 'barre';
|
/** Au bureau, le panneau latéral ne couvre pas la scène : la visite continue aussi en résumé (checkpoint du 03/11 : N8 contre N13). */
|
||||||
|
export const parcoursActif = (etat: Etat, bureau = false): boolean => !PAUSE_DEPLIE || etat === 'barre' || (bureau && etat === 'resume');
|
||||||
/** Le plein couvre la scène : la caméra ne s'y recadre pas (elle garde le cadrage du résumé). N12. */
|
/** Le plein couvre la scène : la caméra ne s'y recadre pas (elle garde le cadrage du résumé). N12. */
|
||||||
export const etatCamera = (etat: Etat): Etat => (etat === 'plein' ? 'resume' : etat);
|
export const etatCamera = (etat: Etat): Etat => (etat === 'plein' ? 'resume' : etat);
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -106,7 +106,8 @@ body[data-echelle="XL"] #b-tourner, body.bandeau-plein #b-tourner { display: non
|
|||||||
.vers-planche.carte-b { background: var(--quartier-encre); }
|
.vers-planche.carte-b { background: var(--quartier-encre); }
|
||||||
.onglets { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: none; }
|
.onglets { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: none; }
|
||||||
.onglets::-webkit-scrollbar { display: none; }
|
.onglets::-webkit-scrollbar { display: none; }
|
||||||
.onglets button { flex: none; display: flex; align-items: center; gap: 6px; border: 1px solid var(--trait); background: #fff; border-radius: 999px; padding: 5px 12px; min-height: 34px;
|
.onglets button::after, .maillon::after, .ec-tete button::after { content: ''; position: absolute; inset: -4px 0; } /* cibles du doigt ≥ 40 px sans grossir le dessin (checkpoint du 03/11, N17) */
|
||||||
|
.onglets button { position: relative; flex: none; display: flex; align-items: center; gap: 6px; border: 1px solid var(--trait); background: #fff; border-radius: 999px; padding: 5px 12px; min-height: 34px;
|
||||||
font: 600 13.5px/1 "Barlow Condensed", Barlow, sans-serif; text-transform: uppercase; letter-spacing: .05em; color: var(--c-encre, var(--encre)); }
|
font: 600 13.5px/1 "Barlow Condensed", Barlow, sans-serif; text-transform: uppercase; letter-spacing: .05em; color: var(--c-encre, var(--encre)); }
|
||||||
.onglets button i { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--auj)); }
|
.onglets button i { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--auj)); }
|
||||||
.onglets button[aria-current="true"] { background: var(--c-fond, var(--papier)); border-color: var(--c, var(--encre)); }
|
.onglets button[aria-current="true"] { background: var(--c-fond, var(--papier)); border-color: var(--c, var(--encre)); }
|
||||||
@@ -129,7 +130,7 @@ body[data-echelle="XL"] #b-tourner, body.bandeau-plein #b-tourner { display: non
|
|||||||
.fil::-webkit-scrollbar { display: none; }
|
.fil::-webkit-scrollbar { display: none; }
|
||||||
.fil:empty { display: none; }
|
.fil:empty { display: none; }
|
||||||
.fil i { flex: 1 1 6px; min-width: 6px; max-width: 26px; height: 0; border-top: 2px dotted var(--c, var(--trait)); opacity: .55; }
|
.fil i { flex: 1 1 6px; min-width: 6px; max-width: 26px; height: 0; border-top: 2px dotted var(--c, var(--trait)); opacity: .55; }
|
||||||
.maillon { flex: none; border: 0; padding: 0; background: none; border-radius: 50%; width: 32px; height: 32px; display: grid; place-items: center; transition: transform .25s, opacity .25s, filter .25s; }
|
.maillon { position: relative; flex: none; border: 0; padding: 0; background: none; border-radius: 50%; width: 32px; height: 32px; display: grid; place-items: center; transition: transform .25s, opacity .25s, filter .25s; }
|
||||||
.maillon img, .maillon svg { width: 100%; height: 100%; display: block; border-radius: 50%; }
|
.maillon img, .maillon svg { width: 100%; height: 100%; display: block; border-radius: 50%; }
|
||||||
.maillon:not(.vu):not(.ici) { opacity: .5; filter: saturate(.5); }
|
.maillon:not(.vu):not(.ici) { opacity: .5; filter: saturate(.5); }
|
||||||
.maillon.ici { width: 42px; height: 42px; box-shadow: 0 0 0 3px var(--c-fond, #fff), 0 0 0 5px var(--c, var(--encre)); }
|
.maillon.ici { width: 42px; height: 42px; box-shadow: 0 0 0 3px var(--c-fond, #fff), 0 0 0 5px var(--c, var(--encre)); }
|
||||||
@@ -282,7 +283,7 @@ body.sur-carte #b-tourner { display: none; }
|
|||||||
/* le texte d'une étape, à la place de la fiche : le même bandeau (classe .bandeau), en résumé dès qu'on touche une étape */
|
/* le texte d'une étape, à la place de la fiche : le même bandeau (classe .bandeau), en résumé dès qu'on touche une étape */
|
||||||
body.etape-ouverte #fiches { display: none; }
|
body.etape-ouverte #fiches { display: none; }
|
||||||
.ec-tete { display: flex; flex: none; }
|
.ec-tete { display: flex; flex: none; }
|
||||||
.ec-tete button { border: 1px solid var(--trait); background: #fff; border-radius: 999px; padding: 0 12px; min-height: 34px; font-weight: 500; font-size: 13.5px; }
|
.ec-tete button { position: relative; border: 1px solid var(--trait); background: #fff; border-radius: 999px; padding: 0 12px; min-height: 34px; font-weight: 500; font-size: 13.5px; }
|
||||||
#ec-corps .icone { overflow: hidden; border: 2px dotted var(--c); }
|
#ec-corps .icone { overflow: hidden; border: 2px dotted var(--c); }
|
||||||
#ec-corps .icone img { object-fit: cover; }
|
#ec-corps .icone img { object-fit: cover; }
|
||||||
#ec-corps .icone.rect { border-radius: 28px; }
|
#ec-corps .icone.rect { border-radius: 28px; }
|
||||||
|
|||||||
@@ -98,6 +98,8 @@ test('nav : le parcours tourne replié, attend déplié ; la caméra ignore le p
|
|||||||
assert.equal(parcoursActif('barre'), true);
|
assert.equal(parcoursActif('barre'), true);
|
||||||
assert.equal(parcoursActif('resume'), false);
|
assert.equal(parcoursActif('resume'), false);
|
||||||
assert.equal(parcoursActif('plein'), false);
|
assert.equal(parcoursActif('plein'), false);
|
||||||
|
assert.equal(parcoursActif('resume', true), true, 'au bureau, le panneau ne couvre pas la scène : la visite continue en résumé');
|
||||||
|
assert.equal(parcoursActif('plein', true), false);
|
||||||
assert.equal(etatCamera('plein'), 'resume');
|
assert.equal(etatCamera('plein'), 'resume');
|
||||||
assert.equal(etatCamera('barre'), 'barre');
|
assert.equal(etatCamera('barre'), 'barre');
|
||||||
assert.equal(SEUIL_TIRAGE, 40);
|
assert.equal(SEUIL_TIRAGE, 40);
|
||||||
|
|||||||
Reference in New Issue
Block a user