Skip to content

Commit 1e03163

Browse files
committed
Improve minimap UX
Change-Id: I2b8db9ddb3509487339434f19df35f29eba4774c
1 parent bb8483a commit 1e03163

File tree

4 files changed

+266
-144
lines changed

4 files changed

+266
-144
lines changed

ui/src/assets/timeline_page.scss

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,60 @@
4444
.pf-overview-timeline {
4545
height: 70px;
4646
border-bottom: solid 1px var(--pf-color-border);
47+
position: relative;
48+
overflow: hidden;
49+
50+
.pf-minimap__drag-handle {
51+
opacity: 0.2;
52+
background: var(--pf-color-accent);
53+
}
54+
55+
.pf-minimap__brush {
56+
background: var(--pf-color-background);
57+
border: solid 1px var(--pf-color-accent);
58+
width: 12px;
59+
height: 16px;
60+
cursor: col-resize;
61+
transform: translateX(-50%);
62+
border-radius: 3px;
63+
z-index: 1;
64+
65+
&::after {
66+
content: "";
67+
background: var(--pf-color-background);
68+
border: solid 1px var(--pf-color-accent);
69+
border-width: 0 0 1px 1px;
70+
transform: rotate(-45deg);
71+
position: absolute;
72+
top: 8px;
73+
width: 9px;
74+
height: 9px;
75+
border-radius: 3px;
76+
clip-path: polygon(0 0, 0 100%, 100% 100%);
77+
}
78+
79+
&::before {
80+
content: "";
81+
z-index: 2;
82+
border: solid 1px var(--pf-color-accent);
83+
border-width: 0 1px 0 1px;
84+
position: absolute;
85+
width: 3px;
86+
height: 10px;
87+
top: 2px;
88+
left: 2.5px;
89+
}
90+
}
91+
92+
.pf-minimap__brush-line {
93+
position: absolute;
94+
top: 20px; // HEADER_HEIGHT_PX
95+
left: 4px; // Center of the brush
96+
width: 1px;
97+
height: 50px; // Heatmap height (70px - 20px header)
98+
background: var(--pf-color-accent);
99+
pointer-events: none;
100+
}
47101
}
48102
}
49103

ui/src/core/timeline.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -304,20 +304,18 @@ export class TimelineImpl implements Timeline {
304304
}
305305
}
306306

307-
moveStart(delta: number) {
308-
this._visibleWindow = new HighPrecisionTimeSpan(
309-
this._visibleWindow.start.addNumber(delta),
310-
this._visibleWindow.duration - delta,
311-
);
307+
moveStart(start: HighPrecisionTime) {
308+
const endTime = this._visibleWindow.end;
309+
const newDur = endTime.sub(start).toNumber();
310+
this._visibleWindow = new HighPrecisionTimeSpan(start, newDur);
312311

313312
raf.scheduleCanvasRedraw();
314313
}
315314

316-
moveEnd(delta: number) {
317-
this._visibleWindow = new HighPrecisionTimeSpan(
318-
this._visibleWindow.start,
319-
this._visibleWindow.duration + delta,
320-
);
315+
moveEnd(end: HighPrecisionTime) {
316+
const startTime = this._visibleWindow.start;
317+
const newDuration = end.sub(startTime).toNumber();
318+
this._visibleWindow = new HighPrecisionTimeSpan(startTime, newDuration);
321319

322320
raf.scheduleCanvasRedraw();
323321
}

0 commit comments

Comments
 (0)