From 0ff71d9b7f46d0a3f8bbb7663ca1e89f203e2a6a Mon Sep 17 00:00:00 2001 From: Jules Neny Date: Tue, 27 Oct 2026 13:00:09 +0100 Subject: [PATCH] =?UTF-8?q?fix(connaissances):=20B19=20M6=20=E2=80=94=20re?= =?UTF-8?q?cette=20:=20libell=C3=A9s=20born=C3=A9s=20au=20cadre=20(colonne?= =?UTF-8?q?=20=C3=A9troite),=20recadrage=20anim=C3=A9=20aussi=20quand=20la?= =?UTF-8?q?=20fiche=20s'ouvre?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0179wsewuntMrKBA2s9y7ZeX --- components/GrapheConnaissances.vue | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/components/GrapheConnaissances.vue b/components/GrapheConnaissances.vue index b1b382d..c08f307 100644 --- a/components/GrapheConnaissances.vue +++ b/components/GrapheConnaissances.vue @@ -263,7 +263,7 @@ const OPTIONS_PAS: { v: Pas; libelle: string }[] = [ ] const DUREE = 600 // recadrage : ≤ 700 ms, puis immobile const MARGE = { haut: 52, bas: 44, gauche: 96, droite: 96 } -const MARGE_TEL = { haut: 52, bas: 84, gauche: 64, droite: 64 } // < 768 : le pied de la vue fiches couvre le bas +const MARGE_TEL = { haut: 52, bas: 84, gauche: 80, droite: 80 } // < 768 : le pied de la vue fiches couvre le bas // ── Taille mesurée (le rendu serveur part d'une taille plausible, comme GrapheMots) ── const racine = ref(null) @@ -277,14 +277,14 @@ onMounted(() => { mq.addEventListener('change', majMq) const el = racine.value if (el && typeof ResizeObserver !== 'undefined') { - const maj = (w: number, h: number) => { + const maj = (w: number, h: number, initiale = false) => { if (w > 40 && h > 40 && (Math.round(w) !== taille.w || Math.round(h) !== taille.h)) { - redim = true + redim = initiale // la première mesure saute ; un redimensionnement (fiche ouverte, fenêtre) se recadre en douceur taille.w = Math.round(w) taille.h = Math.round(h) } } - maj(el.clientWidth, el.clientHeight) + maj(el.clientWidth, el.clientHeight, true) const ro = new ResizeObserver((e) => { const r = e[0]?.contentRect; if (r) maj(r.width, r.height) }) ro.observe(el) onBeforeUnmount(() => ro.disconnect()) @@ -362,12 +362,20 @@ watch(cible, (c) => { raf = requestAnimationFrame(pasAnim) }) +/** Bord à garder libre autour du centre d'un nœud : la demi-largeur maximale d'un libellé (9,5 rem) pour un principal. */ +const BORD_PRINCIPAL = 80 +const BORD_SECONDAIRE = 12 +const kindDe = computed(() => new Map(props.noeuds.map((x) => [x.id, x.kind]))) const ecran = (id: string): Pt | null => { const p = pt(id) if (!p) return null const z = zone.value + const x = (p.x - camera.cx) * camera.s + z.x + z.w / 2 + // Garde-fou : aucun libellé ne sort du cadre, même en pleine animation ou sur une colonne étroite. + const b = principaux.value.has(kindDe.value.get(id) ?? '') ? BORD_PRINCIPAL : BORD_SECONDAIRE + const xBorne = taille.w > 2 * b ? Math.min(taille.w - b, Math.max(b, x)) : x return { - x: Math.round(((p.x - camera.cx) * camera.s + z.x + z.w / 2) * 10) / 10, + x: Math.round(xBorne * 10) / 10, y: Math.round(((p.y - camera.cy) * camera.s + z.y + z.h / 2) * 10) / 10, } }