From b36a4b63a3f3e36541bdc4d38128cf4d2db09ef1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jules=20N=C3=A9ny?= Date: Sat, 14 Nov 2026 11:51:57 +0100 Subject: [PATCH] =?UTF-8?q?Lot=20M1=20table=20:=20une=20ligne=20ajout?= =?UTF-8?q?=C3=A9e=20en=20bas=20(une=20deuxi=C3=A8me=20ruche)=20pose=20un?= =?UTF-8?q?=20objet=20de=20plus=20sans=20bouger=20les=20autres=20;=20le=20?= =?UTF-8?q?cadrage=20d'un=20objet=20reste=20celui=20de=20sa=20premi=C3=A8r?= =?UTF-8?q?e=20ligne?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- maquette/objets.js | 5 +++-- maquette/temoin.ts | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/maquette/objets.js b/maquette/objets.js index 9870abf..587db73 100644 --- a/maquette/objets.js +++ b/maquette/objets.js @@ -698,7 +698,7 @@ export function objetsNouveaux({ D, groupe, T, P, maisons, tr, PAL, geoP, verre, const f = ty.fabrique(place_, l), objs = [f.o, ...(f.extra || [])]; if (ty.roule) { // un objet qui roule : il n'occupe aucune place, son cadrage le suit groupe.add(f.o); const r = roule(f.o, place_.trajet, { v: place_.v, ...ty.roule(place_.trajet, tr) }); - maj.push(r.maj); if (l.fiche) relie(objs, l.fiche, l.cadrage.nom); points[l.cadrage.nom] = r.centre; posees[l.id] = { ...place_, objs, centre: r.centre }; + maj.push(r.maj); if (l.fiche) relie(objs, l.fiche, l.cadrage.nom); points[l.cadrage.nom] ??= r.centre; posees[l.id] = { ...place_, objs, centre: r.centre }; continue; } const { x, z, rot } = place_, a = place_.a ?? l.tailles[0][0] / 2, b = place_.b ?? l.tailles[0][1] / 2, dx = ty.decal || 0; @@ -710,7 +710,8 @@ export function objetsNouveaux({ D, groupe, T, P, maisons, tr, PAL, geoP, verre, if (cad && 'avec' in cad) { // le cadrage d'une autre ligne s'élargit pour montrer les deux const A = posees[cad.avec], nom = lignes.find((k) => k.id === cad.avec).cadrage.nom, d = Math.hypot(x - A.x, z - A.z); relie(objs, l.fiche, nom, { x: (A.x + x) / 2, z: (A.z + z) / 2, w: Math.min(66, Math.max(A.w, d + 28)) }); - } else if (l.fiche) relie(objs, l.fiche, cad.nom, cad.w === null ? undefined : ty.point ? ty.point(place_, cad.w) : { x, z, w: cad.w }); + // un cadrage déjà posé par une ligne au-dessus (une deuxième ruche) reste le sien : la fiche montre le premier objet + } else if (l.fiche) relie(objs, l.fiche, cad.nom, cad.w === null || points[cad.nom] ? undefined : ty.point ? ty.point(place_, cad.w) : { x, z, w: cad.w }); } return { anim, maj, cliquables, points, lumieres, haieOuverte, laisses, maisonsObjets, retouches: mesureRetouches }; diff --git a/maquette/temoin.ts b/maquette/temoin.ts index 19f0235..448ddbd 100644 --- a/maquette/temoin.ts +++ b/maquette/temoin.ts @@ -56,7 +56,9 @@ export function comparerReleves(a: any, b: any, cm = 0.01, deg = 0.1): Ecart[] { for (const o of a[cle] || []) un(o, B.get(o.id ?? o.i), `${cle} ${o.id ?? o.i}`); if ((b[cle] || []).length !== (a[cle] || []).length) e.push(`${cle} : ${(a[cle] || []).length} avant, ${(b[cle] || []).length} après`); } - const ordreA = (a.poses || []).map((o: any) => o.id).join(','), ordreB = (b.poses || []).map((o: any) => o.id).join(','); + // l'ordre d'ajout des objets communs (une ligne ajoutée en bas de la table ajoute un objet à la fin, sans changer l'ordre) + const idsB = new Set((b.poses || []).map((o: any) => o.id)), idsA = new Set((a.poses || []).map((o: any) => o.id)); + const ordreA = (a.poses || []).map((o: any) => o.id).filter((i: string) => idsB.has(i)).join(','), ordreB = (b.poses || []).map((o: any) => o.id).filter((i: string) => idsA.has(i)).join(','); if (ordreA !== ordreB) e.push('poses : l\'ordre d\'ajout a changé'); for (const k of new Set([...Object.keys(a.points || {}), ...Object.keys(b.points || {})])) { const p = a.points[k], q = b.points?.[k];