Skip to content

Commit

Permalink
Clamp the plot coordinates to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
ToniMarc1990 authored Feb 25, 2024
1 parent 7d30488 commit 2ea0ced
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -794,11 +794,11 @@ private Map<Axis, ZoomState> getZoomDataWindows() {
double dataMin;
double dataMax;
if (axis.getSide().isVertical()) {
dataMin = axis.getValueForDisplay(Math.min(axis.getHeight(), minPlotCoordinate.getY()));
dataMax = axis.getValueForDisplay(Math.min(axis.getHeight(), maxPlotCoordinate.getY()));
dataMin = axis.getValueForDisplay(Math.max(0, Math.min(axis.getHeight(), minPlotCoordinate.getY())));
dataMax = axis.getValueForDisplay(Math.max(0, Math.min(axis.getHeight(), maxPlotCoordinate.getY())));

Check warning on line 798 in chartfx-chart/src/main/java/io/fair_acc/chartfx/plugins/Zoomer.java

View check run for this annotation

Codecov / codecov/patch

chartfx-chart/src/main/java/io/fair_acc/chartfx/plugins/Zoomer.java#L797-L798

Added lines #L797 - L798 were not covered by tests
} else {
dataMin = axis.getValueForDisplay(Math.min(axis.getWidth(), minPlotCoordinate.getX()));
dataMax = axis.getValueForDisplay(Math.min(axis.getWidth(), maxPlotCoordinate.getX()));
dataMin = axis.getValueForDisplay(Math.max(0, Math.min(axis.getWidth(), minPlotCoordinate.getX())));
dataMax = axis.getValueForDisplay(Math.max(0, Math.min(axis.getWidth(), maxPlotCoordinate.getX())));

Check warning on line 801 in chartfx-chart/src/main/java/io/fair_acc/chartfx/plugins/Zoomer.java

View check run for this annotation

Codecov / codecov/patch

chartfx-chart/src/main/java/io/fair_acc/chartfx/plugins/Zoomer.java#L800-L801

Added lines #L800 - L801 were not covered by tests
}
switch (getAxisMode()) {
case X:
Expand Down

0 comments on commit 2ea0ced

Please sign in to comment.