Refactor Scrolling and Tracks using Panels
In this CL:
* We introduce the interface Panel, which only two methods: renderCanvas
and updateDom.
* Tracks are internally reimplemented as Panels. Track extension API
remains unchanged (except they now get timeScale and
visibleWindowMs through a global.)
* Introduce LightRedrawer, which schedules rafs for high frequency
drawing. All canvas drawing now happens through LightRedrawer,
although m.redraw still remains in most places until we change
overview timeline to work with LightRedrawer.
* Lift out state used by canvas redrawing to global FrontendLocalState
object, since attributes do not propagate through the mithril tree
if m.redraw is not called.
* Scrolling architecture is simplified. CanvasController, Scrollable
Container, and CanvasWrapper are all gone, replaced with the single
ScrollingPanelContainer.
What's not in this CL:
* We don't have a non-scrolling panel container. We can factor out the
common code between scrolling and non-scrolling container and do that
in a seperate CL.
* We don't have any additional panels other than tracks.
Known issues:
* The trace doesn't draw after loading until you pan/zoom for the first
time. We will need to initialize the time scale and visibleWindowMs
properly after a trace load.
Change-Id: I924be19e10e160f710dae920bfa1927e66ec8be9
diff --git a/ui/src/frontend/track.ts b/ui/src/frontend/track.ts
index aaad16b..27b2158 100644
--- a/ui/src/frontend/track.ts
+++ b/ui/src/frontend/track.ts
@@ -14,8 +14,6 @@
import {TrackState} from '../common/state';
-import {TimeScale} from './time_scale';
-
/**
* This interface forces track implementations to have some static properties.
* Typescript does not have abstract static members, which is why this needs to
@@ -42,9 +40,7 @@
*/
abstract consumeData(trackData: {}): void;
constructor(protected trackState: TrackState) {}
- abstract renderCanvas(
- ctx: CanvasRenderingContext2D, timeScale: TimeScale,
- visibleWindowMs: {start: number, end: number}): void;
+ abstract renderCanvas(ctx: CanvasRenderingContext2D): void;
onMouseMove(_position: {x: number, y: number}) {}
onMouseOut() {}
}