Skip to content

Commit

Permalink
Initial zoom in Zoomer is incorrect
Browse files Browse the repository at this point in the history
+ Clamp the plot coordinates to the axis range before querying the values for display
  • Loading branch information
ToniMarc1990 authored Feb 22, 2024
1 parent fac84bf commit 7d30488
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(minPlotCoordinate.getY());
dataMax = axis.getValueForDisplay(maxPlotCoordinate.getY());
dataMin = axis.getValueForDisplay(Math.min(axis.getHeight(), minPlotCoordinate.getY()));
dataMax = axis.getValueForDisplay(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(minPlotCoordinate.getX());
dataMax = axis.getValueForDisplay(maxPlotCoordinate.getX());
dataMin = axis.getValueForDisplay(Math.min(axis.getWidth(), minPlotCoordinate.getX()));
dataMax = axis.getValueForDisplay(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 7d30488

Please sign in to comment.