feat: enhance measurement duration to show d h m and refine label anchoring
This commit is contained in:
@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user