perfetto-ui: Show vertical line on note preview
Added a vertical line when hovering on the notes panel.
Change-Id: I6da5bed359f37d23204ebaf5147860a9ab80adb2
diff --git a/ui/src/frontend/track_panel.ts b/ui/src/frontend/track_panel.ts
index 591658e..a8ac2f4 100644
--- a/ui/src/frontend/track_panel.ts
+++ b/ui/src/frontend/track_panel.ts
@@ -19,6 +19,7 @@
import {globals} from './globals';
import {drawGridLines} from './gridline_helper';
+import {drawVerticalLine} from './vertical_line_helper';
import {Panel, PanelSize} from './panel';
import {Track} from './track';
import {TRACK_SHELL_WIDTH} from './track_constants';
@@ -210,5 +211,26 @@
this.track.renderCanvas(ctx);
ctx.restore();
+
+ const localState = globals.frontendLocalState;
+ // Draw vertical line when hovering on the the notes panel.
+ if (localState.hoveredTimestamp !== -1) {
+ drawVerticalLine(ctx,
+ localState.timeScale,
+ localState.hoveredTimestamp,
+ size.height,
+ `#aaa`);
+ }
+
+ // Draw vertical line when a note is selected.
+ if (globals.state.currentSelection !== null &&
+ globals.state.currentSelection.kind === 'NOTE') {
+ const note = globals.state.notes[globals.state.currentSelection.id];
+ drawVerticalLine(ctx,
+ localState.timeScale,
+ note.timestamp,
+ size.height,
+ note.color);
+ }
}
}