Skip to content

Commit

Permalink
Set limit on zoom-in factor
Browse files Browse the repository at this point in the history
fixes #86

Signed-off-by: muddana-satish <satish.muddana@ericsson.com>
  • Loading branch information
muddana-satish authored and MatthewKhouzam committed Jan 8, 2021
1 parent 369705f commit cd42151
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions timeline-chart/src/components/time-graph-axis-scale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,11 @@ export class TimeGraphAxisScale extends TimeGraphComponent {
if (end > this.unitController.absoluteRange) {
end = this.unitController.absoluteRange;
}
this.unitController.viewRange = {
start,
end
if (Math.trunc(start) !== Math.trunc(end)) {
this.unitController.viewRange = {
start,
end
}
}
}

Expand Down
8 changes: 5 additions & 3 deletions timeline-chart/src/layer/time-graph-chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,11 @@ export class TimeGraphChart extends TimeGraphChartLayer {
const xOffset = ((zoomPosition / this.unitController.viewRangeLength) * deltaLength);
const start = Math.max(0, this.unitController.viewRange.start - xOffset);
const end = Math.min(start + newViewRangeLength, this.unitController.absoluteRange);
this.unitController.viewRange = {
start,
end
if (Math.trunc(start) !== Math.trunc(end)) {
this.unitController.viewRange = {
start,
end
}
}
};

Expand Down

0 comments on commit cd42151

Please sign in to comment.