v8/tools/system-analyzer/view/events.mjs
Camillo Bruni c39e47aaa0 [tools][system-analyzer] Improve selection support
- Double click on the current timeline selection to focus and zoom in
- Make timeline-tracks focusable by setting a tabindex
- Add back arrow-key navigation for the map panel (only when focused)
- Prepare code for adding keyboard-based horizontal scrolling
- Use --code-font CSS variable

Bug: v8:10644
Change-Id: Ic473695c9fcdc795d173cd064b4660e100ae8b24
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3568475
Reviewed-by: Patrick Thier <pthier@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79786}
2022-04-05 18:42:03 +00:00

96 lines
2.0 KiB
JavaScript

// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
class AppEvent extends CustomEvent {
constructor(name) {
super(name, {bubbles: true, composed: true});
}
}
export class SelectionEvent extends AppEvent {
// TODO: turn into static class fields once Safari supports it.
static get name() {
return 'select';
}
constructor(entries) {
super(SelectionEvent.name);
if (!Array.isArray(entries) || entries.length == 0) {
throw new Error('No valid entries selected!');
}
this.entries = entries;
}
}
export class SelectRelatedEvent extends AppEvent {
static get name() {
return 'selectrelated';
}
constructor(entry) {
super(SelectRelatedEvent.name);
this.entry = entry;
}
}
export class FocusEvent extends AppEvent {
static get name() {
return 'showentrydetail';
}
constructor(entry) {
super(FocusEvent.name);
this.entry = entry;
}
}
export class SelectTimeEvent extends AppEvent {
static get name() {
return 'timerangeselect';
}
constructor(start = 0, end = Infinity, focus = false, zoom = false) {
super(SelectTimeEvent.name);
this.start = start;
this.end = end;
this.focus = focus;
this.zoom = zoom;
}
}
export class SynchronizeSelectionEvent extends AppEvent {
static get name() {
return 'syncselection';
}
constructor(start, end) {
super(SynchronizeSelectionEvent.name);
this.start = start;
this.end = end;
}
}
export class ToolTipEvent extends AppEvent {
static get name() {
return 'showtooltip';
}
constructor(content, positionOrTargetNode) {
super(ToolTipEvent.name);
if (!positionOrTargetNode) {
throw Error('Either provide a valid position or targetNode');
}
this._content = content;
this._positionOrTargetNode = positionOrTargetNode;
}
get content() {
return this._content;
}
get positionOrTargetNode() {
return this._positionOrTargetNode;
}
}