Skip to content

Commit

Permalink
Zoom into selection range using z
Browse files Browse the repository at this point in the history
Allows user to press z to zoom to current selection.
Adds relevant information to keyboard shortcut menu.

Signed-off-by: Will Yang <william.yang@ericsson.com>
  • Loading branch information
williamsyang-work authored and MatthewKhouzam committed Aug 3, 2022
1 parent 70ea08a commit 28039a3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,10 @@ export class TraceContextComponent extends React.Component<TraceContextProps, Tr
this.zoomButton(false);
break;
}
case 'z': {
this.zoomToSelected();
break;
}
}
}

Expand All @@ -458,6 +462,13 @@ export class TraceContextComponent extends React.Component<TraceContextProps, Tr
}
}

private zoomToSelected(): void {
const newZoom = this.unitController.selectionRange;
if (newZoom) {
this.unitController.viewRange = newZoom;
}
}

private renderOutputs() {
this.generateGridLayout();
const chartWidth = Math.max(0, this.state.style.width - this.state.style.chartOffset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ export class TimeGraphShortcutsTable extends React.Component {
<span className='monaco-keybinding-key'><i className='fa fa-arrow-down' /></span>
</td>
</tr>
<tr>
<td>Zoom to selected</td>
<td className='monaco-keybinding shortcuts-table-keybinding'>
<span className='monaco-keybinding-key'>Z</span>
</td>
</tr>
</tbody>
</table>
</div>
Expand Down

0 comments on commit 28039a3

Please sign in to comment.