Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions frontend/app/components/trace_viewer_v2/application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ EMSCRIPTEN_KEEPALIVE emscripten::val GetPresetPalettes() {
return result;
}

// Sets the visible time range of the timeline. `start_us` and `end_us` are in
// microseconds. This is primarily used by the Live Trace Viewer to auto-follow
// the newest sliding window as new streaming data arrives.
EMSCRIPTEN_KEEPALIVE void SetVisibleRange(double start_us, double end_us) {
Application::Instance().timeline().SetVisibleRange({start_us, end_us});
Application::Instance().RequestRedraw();
}

EMSCRIPTEN_BINDINGS(traceviewer) {
emscripten::function("SetPalette", &SetPalette);
emscripten::function("SetColor", &SetColor);
Expand All @@ -194,6 +202,7 @@ EMSCRIPTEN_BINDINGS(traceviewer) {
emscripten::function("RequestRedraw", &RequestRedraw);
emscripten::function("SetPlaybackState", &SetPlaybackState);
emscripten::function("GetPresetPalettes", &GetPresetPalettes);
emscripten::function("setVisibleRange", &SetVisibleRange);
}

EMSCRIPTEN_BINDINGS(colors) {
Expand Down
5 changes: 5 additions & 0 deletions frontend/app/components/trace_viewer_v2/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ declare global {
* off. Hover highlighting, hover events and selection are unaffected.
*/
SetEventTooltipEnabled?(enabled: boolean): void;
// Sets the visible time range of the timeline. Both arguments are in
// microseconds. Registered as a module-level Emscripten function (see
// `SetVisibleRange` in application.cc). Used by the Live Trace Viewer to
// auto-follow the newest sliding window as streaming data arrives.
setVisibleRange(startUs: number, endUs: number): void;
canvas: HTMLCanvasElement;
callMain(args: string[]): void;
preinitializedWebGPUDevice: GPUDevice | null;
Expand Down
Loading