@@ -1943,8 +1943,7 @@ bool UpdateInput(ImPlotPlot& plot) {
1943
1943
if (IO.MouseDelta .x != 0 && !x_axis.IsPanLocked (increasing)) {
1944
1944
const double plot_l = x_axis.PixelsToPlot (plot.PlotRect .Min .x - IO.MouseDelta .x );
1945
1945
const double plot_r = x_axis.PixelsToPlot (plot.PlotRect .Max .x - IO.MouseDelta .x );
1946
- x_axis.SetMin (x_axis.IsInverted () ? plot_r : plot_l);
1947
- x_axis.SetMax (x_axis.IsInverted () ? plot_l : plot_r);
1946
+ x_axis.SetMinMax (x_axis.IsInverted () ? plot_r : plot_l, x_axis.IsInverted () ? plot_l : plot_r);
1948
1947
if (axis_equal && x_axis.OrthoAxis != nullptr )
1949
1948
x_axis.OrthoAxis ->SetAspect (x_axis.GetAspect ());
1950
1949
changed = true ;
@@ -1959,8 +1958,7 @@ bool UpdateInput(ImPlotPlot& plot) {
1959
1958
if (IO.MouseDelta .y != 0 && !y_axis.IsPanLocked (increasing)) {
1960
1959
const double plot_t = y_axis.PixelsToPlot (plot.PlotRect .Min .y - IO.MouseDelta .y );
1961
1960
const double plot_b = y_axis.PixelsToPlot (plot.PlotRect .Max .y - IO.MouseDelta .y );
1962
- y_axis.SetMin (y_axis.IsInverted () ? plot_t : plot_b);
1963
- y_axis.SetMax (y_axis.IsInverted () ? plot_b : plot_t );
1961
+ y_axis.SetMinMax (y_axis.IsInverted () ? plot_t : plot_b, y_axis.IsInverted () ? plot_b : plot_t );
1964
1962
if (axis_equal && y_axis.OrthoAxis != nullptr )
1965
1963
y_axis.OrthoAxis ->SetAspect (y_axis.GetAspect ());
1966
1964
changed = true ;
@@ -1995,36 +1993,30 @@ bool UpdateInput(ImPlotPlot& plot) {
1995
1993
const bool equal_zoom = axis_equal && x_axis.OrthoAxis != nullptr ;
1996
1994
const bool equal_locked = (equal_zoom != false ) && x_axis.OrthoAxis ->IsInputLocked ();
1997
1995
if (x_hov[i] && !x_axis.IsInputLocked () && !equal_locked) {
1998
- ImGui::SetKeyOwner (ImGuiKey_MouseWheelY, plot.ID );
1999
1996
if (zoom_rate != 0 .0f ) {
2000
1997
float correction = (plot.Hovered && equal_zoom) ? 0 .5f : 1 .0f ;
2001
1998
const double plot_l = x_axis.PixelsToPlot (plot.PlotRect .Min .x - rect_size.x * tx * zoom_rate * correction);
2002
1999
const double plot_r = x_axis.PixelsToPlot (plot.PlotRect .Max .x + rect_size.x * (1 - tx) * zoom_rate * correction);
2003
- x_axis.SetMin (x_axis.IsInverted () ? plot_r : plot_l);
2004
- x_axis.SetMax (x_axis.IsInverted () ? plot_l : plot_r);
2000
+ x_axis.SetMinMax (x_axis.IsInverted () ? plot_r : plot_l, x_axis.IsInverted () ? plot_l : plot_r, false , x_axis.IsInverted () ? (1 - tx) : tx);
2005
2001
if (axis_equal && x_axis.OrthoAxis != nullptr )
2006
2002
x_axis.OrthoAxis ->SetAspect (x_axis.GetAspect ());
2007
2003
changed = true ;
2008
2004
}
2009
- }
2010
2005
}
2011
2006
for (int i = 0 ; i < IMPLOT_NUM_Y_AXES; i++) {
2012
2007
ImPlotAxis& y_axis = plot.YAxis (i);
2013
2008
const bool equal_zoom = axis_equal && y_axis.OrthoAxis != nullptr ;
2014
2009
const bool equal_locked = equal_zoom && y_axis.OrthoAxis ->IsInputLocked ();
2015
2010
if (y_hov[i] && !y_axis.IsInputLocked () && !equal_locked) {
2016
- ImGui::SetKeyOwner (ImGuiKey_MouseWheelY, plot.ID );
2017
2011
if (zoom_rate != 0 .0f ) {
2018
2012
float correction = (plot.Hovered && equal_zoom) ? 0 .5f : 1 .0f ;
2019
2013
const double plot_t = y_axis.PixelsToPlot (plot.PlotRect .Min .y - rect_size.y * ty * zoom_rate * correction);
2020
2014
const double plot_b = y_axis.PixelsToPlot (plot.PlotRect .Max .y + rect_size.y * (1 - ty) * zoom_rate * correction);
2021
- y_axis.SetMin (y_axis.IsInverted () ? plot_t : plot_b);
2022
- y_axis.SetMax (y_axis.IsInverted () ? plot_b : plot_t );
2015
+ y_axis.SetMinMax (y_axis.IsInverted () ? plot_t : plot_b, y_axis.IsInverted () ? plot_b : plot_t , false , y_axis.IsInverted () ? (1 - tx) : tx);
2023
2016
if (axis_equal && y_axis.OrthoAxis != nullptr )
2024
2017
y_axis.OrthoAxis ->SetAspect (y_axis.GetAspect ());
2025
2018
changed = true ;
2026
2019
}
2027
- }
2028
2020
}
2029
2021
}
2030
2022
@@ -2041,8 +2033,7 @@ bool UpdateInput(ImPlotPlot& plot) {
2041
2033
if (!x_axis.IsInputLocked () && x_can_change) {
2042
2034
const double p1 = x_axis.PixelsToPlot (plot.SelectStart .x );
2043
2035
const double p2 = x_axis.PixelsToPlot (IO.MousePos .x );
2044
- x_axis.SetMin (ImMin (p1, p2));
2045
- x_axis.SetMax (ImMax (p1, p2));
2036
+ x_axis.SetMinMax (ImMin (p1, p2), ImMax (p1, p2));
2046
2037
changed = true ;
2047
2038
}
2048
2039
}
@@ -2051,8 +2042,7 @@ bool UpdateInput(ImPlotPlot& plot) {
2051
2042
if (!y_axis.IsInputLocked () && y_can_change) {
2052
2043
const double p1 = y_axis.PixelsToPlot (plot.SelectStart .y );
2053
2044
const double p2 = y_axis.PixelsToPlot (IO.MousePos .y );
2054
- y_axis.SetMin (ImMin (p1, p2));
2055
- y_axis.SetMax (ImMax (p1, p2));
2045
+ y_axis.SetMinMax (ImMin (p1, p2), ImMax (p1, p2));
2056
2046
changed = true ;
2057
2047
}
2058
2048
}
0 commit comments