Commit 21ced9c7 authored by Austin Clements's avatar Austin Clements

cmd/trace: encode selection in trace URL

This adds the ability to add a #x:y anchor to the trace view URL that
causes the viewer to initially select from x ms to y ms.

Change-Id: I4a980d8128ecc85dbe41f224e8ae336707a4eaab
Reviewed-on: https://go-review.googlesource.com/60794
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarHyang-Ah Hana Kim <hyangah@gmail.com>
parent 70fd25e4
......@@ -112,6 +112,17 @@ var templTrace = `
function onModelLoaded() {
viewer.model = model;
viewer.viewTitle = "trace";
if (!model || model.bounds.isEmpty)
return;
var sel = window.location.hash.substr(1);
if (sel === '')
return;
var parts = sel.split(':');
var range = new (tr.b.Range || tr.b.math.Range)();
range.addValue(parseFloat(parts[0]));
range.addValue(parseFloat(parts[1]));
viewer.trackView.viewport.interestRange.set(range);
}
function onImportFail(err) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment