Skip to content

Commit

Permalink
Press esc to cancel mouse zooming
Browse files Browse the repository at this point in the history
Signed-off-by: muddana-satish <satish.muddana@ericsson.com>
  • Loading branch information
muddana-satish authored and bhufmann committed Jul 6, 2021
1 parent ee7a95c commit edf1d44
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ A reusable time axis component, that can be used independently of the other comp
* Horizontal zooming can be performed using Ctrl+mouse wheel. The zooming is centered on the mouse cursor position.
* Horizontal panning can be performed using the middle mouse button or Ctrl+left mouse button.
* Horizontal zooming selection can be performed using the right mouse button.
* Horizontal zooming can be cancelled by pressing the `esc` button while zooming using the right click + drag.
* The view is connected to a time controller instance and synchronizes its viewport, zoom level cursors bi-directionally.

## Data Model
Expand Down
5 changes: 5 additions & 0 deletions timeline-chart/src/layer/time-graph-chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ export class TimeGraphChart extends TimeGraphChartLayer {
}
event.preventDefault();
}
if (keyPressed === 'Escape' && this.mouseZooming) {
this.mouseZooming = false;
this.stage.cursor = 'default';
this.updateZoomingSelection();
}
};
this._keyUpHandler = (event: KeyboardEvent) => {
const keyPressed = event.key;
Expand Down

0 comments on commit edf1d44

Please sign in to comment.