Skip to content

Commit

Permalink
ZoomerPlugin: Initial zoom is incorrect (#660)
Browse files Browse the repository at this point in the history
Clamp the plot coordinates to [0, axisHeight/Width] before querying the values for display
  • Loading branch information
ToniMarc1990 authored Feb 27, 2024
1 parent fac84bf commit 6ab7a28
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.max(0, Math.min(axis.getHeight(), minPlotCoordinate.getY())));
dataMax = axis.getValueForDisplay(Math.max(0, Math.min(axis.getHeight(), maxPlotCoordinate.getY())));
} else {
dataMin = axis.getValueForDisplay(minPlotCoordinate.getX());
dataMax = axis.getValueForDisplay(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())));
}
switch (getAxisMode()) {
case X:
Expand Down

0 comments on commit 6ab7a28

Please sign in to comment.