Skip to content

Commit 43fb13c

Browse files
committed
Improve accuracy of Timeline
Don't round left/width, instead use two decimals. This improves accuracy of Timeline when more similar sized entries are shown.
1 parent 8318a65 commit 43fb13c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/DebugBar/Resources/widgets.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,8 @@ if (typeof(PhpDebugBar) == 'undefined') {
367367
var measure = data.measures[i];
368368
var m = $('<div />').addClass(csscls('measure')),
369369
li = $('<li />'),
370-
left = Math.round(measure.relative_start * 100 / data.duration),
371-
width = Math.min(Math.round(measure.duration * 100 / data.duration), 100 - left);
370+
left = (measure.relative_start * 100 / data.duration).toFixed(2),
371+
width = Math.min((measure.duration * 100 / data.duration).toFixed(2), 100 - left);
372372

373373
m.append($('<span />').addClass(csscls('value')).css({
374374
left: left + "%",

0 commit comments

Comments
 (0)