forked from FroSteel/Planification
v2026.5.35 — Fix popup épinglé position vue horizontale + stats gauche
This commit is contained in:
@@ -7007,13 +7007,60 @@ function pinTooltip() {
|
||||
if (closeAllBtn) closeAllBtn.remove();
|
||||
}
|
||||
|
||||
// Chercher la ligne source (row iv-v2)
|
||||
// Chercher la ligne source pour le positionnement.
|
||||
// v2026.5.35 : en vue horizontale, les rows .intervention-v2 sont CACHÉES
|
||||
// (display: none via CSS .view-horizontal). getBoundingClientRect d'un
|
||||
// élément caché retourne (0,0,0,0) → popup part en haut à gauche.
|
||||
// Solution : priorité au tooltip actuellement visible (qui EST la vraie
|
||||
// source visuelle du clic/hover). Fallback sur le segment timeline. Enfin
|
||||
// la row (qui marche en vue classique).
|
||||
let rowEl = null;
|
||||
if (iv.actionId) {
|
||||
rowEl = document.querySelector(`.intervention-v2[data-action-id="${iv.actionId}"]`);
|
||||
const _isHorizontalView = document.documentElement.classList.contains("view-horizontal");
|
||||
|
||||
if (_isHorizontalView) {
|
||||
console.log("[pinTooltip] vue horizontale → source = tooltip visible ou segment timeline");
|
||||
// Priorité 1 : le tooltip actuellement affiché (meilleure source visuelle)
|
||||
const currentTip = tooltipEl();
|
||||
if (currentTip && currentTip.classList.contains("visible")) {
|
||||
const r = currentTip.getBoundingClientRect();
|
||||
if (r.width > 0 && r.height > 0) {
|
||||
rowEl = currentTip;
|
||||
console.log(`[pinTooltip] source = tooltip visible (${Math.round(r.left)}, ${Math.round(r.top)})`);
|
||||
}
|
||||
}
|
||||
// Priorité 2 : segment timeline pour cette actionId
|
||||
if (!rowEl && iv.actionId) {
|
||||
// Il peut y avoir plusieurs .timeline-slot avec le même ivIdx si plusieurs
|
||||
// cartes. On prend celui dont la row parente a le bon actionId.
|
||||
const allSlots = document.querySelectorAll(".timeline-slot[data-iv-idx]");
|
||||
for (const slot of allSlots) {
|
||||
const card = slot.closest(".card");
|
||||
if (!card) continue;
|
||||
const ivIdx = slot.dataset.ivIdx;
|
||||
const row = card.querySelector(`.intervention-v2[data-iv-idx="${ivIdx}"]`);
|
||||
if (row && row.dataset.actionId === iv.actionId) {
|
||||
const r = slot.getBoundingClientRect();
|
||||
if (r.width > 0 && r.height > 0) {
|
||||
rowEl = slot;
|
||||
console.log(`[pinTooltip] source = segment timeline actionId=${iv.actionId}`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Vue classique : chercher la row .intervention-v2 (comportement d'origine)
|
||||
if (iv.actionId) {
|
||||
rowEl = document.querySelector(`.intervention-v2[data-action-id="${iv.actionId}"]`);
|
||||
if (rowEl) {
|
||||
console.log(`[pinTooltip] vue classique → source = row intervention-v2`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback final : le tooltip live (même s'il n'est pas visible) — position actuelle
|
||||
if (!rowEl) {
|
||||
// Fallback : utiliser la position actuelle du tooltip live
|
||||
console.warn("[pinTooltip] aucune source visible trouvée → fallback tooltip live");
|
||||
rowEl = srcEl;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user