Removing the NaN timestamp error.
Instead a timestamp should appear when you click on the first block in the timeline.
This error occurred due to a negative index in the extreme case.
Bug: 15272217
Test: run a trace, click on the first block in the timeline, check the timestamp to ensure NaN does not appear.
Change-Id: Id829ee773ff68c2a911fbfc35adf0e228701a955
diff --git a/tools/winscope/src/mixins/Timeline.js b/tools/winscope/src/mixins/Timeline.js
index 1f94e3a..40fd341 100644
--- a/tools/winscope/src/mixins/Timeline.js
+++ b/tools/winscope/src/mixins/Timeline.js
@@ -229,7 +229,14 @@
if (this.disabled) {
return;
}
- const timestamp = parseInt(this.timeline[clickedOnTsIndex]);
+
+ var timestamp = parseInt(this.timeline[clickedOnTsIndex]);
+
+ //pointWidth is always 1
+ //if offset percentage < 1, clickedOnTsIndex becomes negative, leading to a negative index
+ if (clickedOnTsIndex < 0) {
+ timestamp = parseInt(this.timeline[0])
+ }
this.$store.dispatch('updateTimelineTime', timestamp);
},