Skip to content

Commit 0cc3870

Browse files
AlinaVarkkiDevtools-frontend LUCI CQ
authored andcommitted
[RPP] Populate shortcuts dialog with the default Timeline shortcuts
In the future we will populate it depending on the current navigation setting. Screenshot: https://screenshot.googleplex.com/3S9S7PEVJ87LLcE Bug: 313757601 Change-Id: I1ddb89cce220758fc6079f03ef9bea8d639197ae Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6025270 Commit-Queue: Alina Varkki <[email protected]> Auto-Submit: Alina Varkki <[email protected]> Reviewed-by: Nancy Li <[email protected]>
1 parent aea4464 commit 0cc3870

File tree

4 files changed

+45
-11
lines changed

4 files changed

+45
-11
lines changed

front_end/panels/timeline/TimelinePanel.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,22 @@ const UIStrings = {
317317
* @description Tooltip text for a button that takes the user back to the default view which shows performance metrics that are live.
318318
*/
319319
backToLiveMetrics: 'Go back to the live metrics page',
320+
/**
321+
* @description Description of the Timeline in/out zoom action that appears in the Performance panel shortcuts dialog.
322+
*/
323+
timelineZoomInOut: 'Timeline zoom in/out',
324+
/**
325+
* @description Description of the Timeline fast in/out zoom action that appears in the Performance panel shortcuts dialog.
326+
*/
327+
timelineFastZoomInOut: 'Timeline fast zoom in/out',
328+
/**
329+
* @description Description of the Timeline up/down scroll action that appears in the Performance panel shortcuts dialog.
330+
*/
331+
timelineScrollUpDown: 'Timeline up/down',
332+
/**
333+
* @description Description of the Timeline right/left panning action that appears in the Performance panel shortcuts dialog.
334+
*/
335+
timelinePanLeftRight: 'Timeline right/left',
320336
};
321337
const str_ = i18n.i18n.registerUIStrings('panels/timeline/TimelinePanel.ts', UIStrings);
322338
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -1091,12 +1107,21 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod
10911107
if (Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.TIMELINE_ALTERNATIVE_NAVIGATION)) {
10921108
// TODO: Fill the shortcuts dialog with shortcuts for the cuttently selected navigation option
10931109
const shortcutDialog = new ShortcutDialog.ShortcutDialog.ShortcutDialog();
1094-
shortcutDialog.data = {shortcuts: [{title: 'Shortcut Title', bindings: ['Ctrl+E']}]};
1110+
shortcutDialog.data = {shortcuts: this.#getShortcutsInfo()};
10951111
const dialogToolbarItem = new UI.Toolbar.ToolbarItem(shortcutDialog);
10961112
this.panelRightToolbar.appendToolbarItem(dialogToolbarItem);
10971113
}
10981114
}
10991115

1116+
#getShortcutsInfo(): ShortcutDialog.ShortcutDialog.Shortcut[] {
1117+
return [
1118+
{title: i18nString(UIStrings.timelineZoomInOut), bindings: ['Scroll', 'W/S']},
1119+
{title: i18nString(UIStrings.timelineFastZoomInOut), bindings: ['Shift W/S']},
1120+
{title: i18nString(UIStrings.timelineScrollUpDown), bindings: ['Shift Scroll']},
1121+
{title: i18nString(UIStrings.timelinePanLeftRight), bindings: ['A/D']},
1122+
];
1123+
}
1124+
11001125
private createSettingsPane(): void {
11011126
this.showSettingsPaneSetting =
11021127
Common.Settings.Settings.instance().createSetting('timeline-show-settings-toolbar', false);

front_end/ui/components/dialogs/ShortcutDialog.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,17 @@ export class ShortcutDialog extends HTMLElement {
159159
html`
160160
<li class="keybinds-list-item">
161161
<div>${shortcut.title}</div>
162-
${shortcut.bindings.map(binding => {
163-
return html`
164-
<div class="keys-container">
165-
${this.#getKeysFromBinding(binding).map(key => html`
166-
<span class="keybinds-key">${key}</span>
167-
`)}
162+
<div class="shortcuts-for-actions">
163+
${shortcut.bindings.map(binding => {
164+
return html`
165+
<div class="keys-container">
166+
${this.#getKeysFromBinding(binding).map(key => html`
167+
<span class="keybinds-key">${key}</span>
168+
`)}
169+
</div>
170+
`;
171+
})}
168172
</div>
169-
`;
170-
})}
171173
</li>`,
172174
)}
173175
</ul>

front_end/ui/components/dialogs/shortcutDialog.css

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
display: flex;
1414
justify-content: space-between;
1515
align-items: center;
16-
padding: var(--sys-size-4) var(--sys-size-6) var(--sys-size-6) var(--sys-size-8);
16+
padding: 0 var(--sys-size-6) var(--sys-size-5) var(--sys-size-8);
1717
}
1818

1919
.keybinds-category-header-text {
@@ -26,7 +26,7 @@
2626
flex-direction: column;
2727
gap: var(--sys-size-4);
2828
margin: 0;
29-
padding: 0 var(--sys-size-8);
29+
padding: 0 var(--sys-size-8) var(--sys-size-3) var(--sys-size-8);
3030
}
3131

3232
.keybinds-list-item {
@@ -50,6 +50,13 @@
5050
gap: var(--sys-size-3);
5151
}
5252

53+
.shortcuts-for-actions {
54+
display: flex;
55+
flex-direction: column;
56+
align-items: flex-end;
57+
gap: var(--sys-size-3);
58+
}
59+
5360
.keybinds-key {
5461
display: flex;
5562
align-items: center;
154 Bytes
Loading

0 commit comments

Comments
 (0)