From 7c92aa38beead4e8907c54f0ea2b0e1e43d04491 Mon Sep 17 00:00:00 2001 From: DiTus Date: Sat, 21 Mar 2026 17:20:39 +0100 Subject: [PATCH] feat: enhance measurement duration to show d h m and refine label anchoring --- js/ui/drawing-tools.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/js/ui/drawing-tools.js b/js/ui/drawing-tools.js index a743357..db4baa3 100644 --- a/js/ui/drawing-tools.js +++ b/js/ui/drawing-tools.js @@ -658,9 +658,17 @@ export class DrawingManager { // Time duration const diffSec = Math.abs(d.p2.time - d.p1.time); - const h = Math.floor(diffSec / 3600); - const m = Math.floor((diffSec % 3600) / 60); - const timeStr = `${h}h${m > 0 ? ` ${m}m` : ''}`; + let timeStr = ""; + if (diffSec >= 86400) { + const days = Math.floor(diffSec / 86400); + const hours = Math.floor((diffSec % 86400) / 3600); + const mins = Math.floor((diffSec % 3600) / 60); + timeStr = `${days}d${hours > 0 ? ` ${hours}h` : ''}${mins > 0 ? ` ${mins}m` : ''}`; + } else { + const hours = Math.floor(diffSec / 3600); + const mins = Math.floor((diffSec % 3600) / 60); + timeStr = `${hours}h${mins > 0 ? ` ${mins}m` : ''}`; + } const volStr = totalVol > 1000 ? `${(totalVol/1000).toFixed(3)}K` : totalVol.toFixed(0);