diff --git a/src/MeasurementControl/measurementsPanel.css b/src/MeasurementControl/measurementsPanel.css index 96f735f..d5fa999 100644 --- a/src/MeasurementControl/measurementsPanel.css +++ b/src/MeasurementControl/measurementsPanel.css @@ -38,9 +38,14 @@ #measurements_list td { padding: 2px 4px; } -#measurements_list tr:nth-child(even) { +#measurements_list table.measurement_value_table tr.alt-even td { background: #3a454b; } + +/* Fallback: ensure odd rows are neutral unless other row-type rules apply */ +#measurements_list table.measurement_value_table tr.alt-odd td { + background: transparent; +} #measurements_list .coordRow td { background: #2f383d; font-family: monospace; diff --git a/src/MeasurementControl/measurementsPanel.js b/src/MeasurementControl/measurementsPanel.js index 6b70ac2..28dc3ac 100644 --- a/src/MeasurementControl/measurementsPanel.js +++ b/src/MeasurementControl/measurementsPanel.js @@ -231,7 +231,10 @@ export function initMeasurementsPanel(viewer) { function initCoordObserver() { if (!originalPropertiesPanel || coordRoundObserver) return coordRoundObserver = new MutationObserver(() => { - requestAnimationFrame(() => roundCoordinates(originalPropertiesPanel)) + requestAnimationFrame(() => { + roundCoordinates(originalPropertiesPanel) + pruneMeasurementRows(originalPropertiesPanel) + }) }) coordRoundObserver.observe(originalPropertiesPanel, { childList: true, @@ -283,6 +286,47 @@ export function initMeasurementsPanel(viewer) { }) }) } + + // Hide unwanted measurement attribute rows (keep only relevant ones) + function pruneMeasurementRows(rootEl) { + if (!rootEl) rootEl = originalPropertiesPanel + if (!rootEl) return + const tables = rootEl.querySelectorAll('table.measurement_value_table') + if (!tables || tables.length === 0) return + // Labels we want to keep + const keep = new Set(['point source id', 'accepted', 'tvu', 'thu']) + tables.forEach((tbl) => { + // Detect coordinate table (header with th: x y z) and skip pruning for it + const headerRow = tbl.querySelector('tr') + if (headerRow) { + const ths = [...headerRow.querySelectorAll('th')].map((th) => + (th.textContent || '').trim().toLowerCase() + ) + if (ths.length >= 3 && ths[0] === 'x' && ths[1] === 'y' && ths[2] === 'z') { + return + } + } + ;[...tbl.querySelectorAll('tr')].forEach((row) => { + const firstTd = row.querySelector('td') + if (!firstTd) return + const txt = (firstTd.textContent || '').trim().toLowerCase() + if (!keep.has(txt)) { + row.style.display = 'none' + } else { + row.style.display = '' + } + }) + // After hiding rows, reapply alternating classes to visible rows so + // zebra striping remains correct even when some rows are display:none + const visibleRows = [...tbl.querySelectorAll('tr')].filter( + (r) => r.style.display !== 'none' + ) + visibleRows.forEach((r, i) => { + r.classList.remove('alt-even', 'alt-odd') + r.classList.add(i % 2 === 0 ? 'alt-odd' : 'alt-even') + }) + }) + } // Helper to decide if a uuid is a measurement-like object function isMeasurementUUID(uuid) { if (!uuid) return false