Skip to content

Commit

Permalink
Fix mouse zooming when mouse released outside time graph
Browse files Browse the repository at this point in the history
The x-coordinate of the mouseUp event is in the coordinates of the
element under the cursor at the time, which is not necessarily the time
graph coordinates.

Since the mouseEndX variable is updated (correctly) while the mouse is
being moved, just rely on that, and do not update it at mouseUp.

Signed-off-by: Patrick Tasse <patrick.tasse@ericsson.com>
  • Loading branch information
PatrickTasse committed Jul 13, 2021
1 parent 8689945 commit 2d3f4d8
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion timeline-chart/src/layer/time-graph-chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ export class TimeGraphChart extends TimeGraphChartLayer {
this.mouseButtons = e.buttons;
if (e.button === this.mouseDownButton && this.mouseZooming) {
this.mouseZooming = false;
this.mouseEndX = e.offsetX;
const start = this.mouseZoomingStart;
const end = this.unitController.viewRange.start + (this.mouseEndX / this.stateController.zoomFactor);
if (start !== end && this.unitController.viewRangeLength > 1) {
Expand Down

0 comments on commit 2d3f4d8

Please sign in to comment.