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
|
// Time duration
|
||||||
const diffSec = Math.abs(d.p2.time - d.p1.time);
|
const diffSec = Math.abs(d.p2.time - d.p1.time);
|
||||||
const h = Math.floor(diffSec / 3600);
|
let timeStr = "";
|
||||||
const m = Math.floor((diffSec % 3600) / 60);
|
if (diffSec >= 86400) {
|
||||||
const timeStr = `${h}h${m > 0 ? ` ${m}m` : ''}`;
|
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);
|
const volStr = totalVol > 1000 ? `${(totalVol/1000).toFixed(3)}K` : totalVol.toFixed(0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user