@@ -1943,8 +1943,7 @@ bool UpdateInput(ImPlotPlot& plot) {
19431943 if (IO.MouseDelta .x != 0 && !x_axis.IsPanLocked (increasing)) {
19441944 const double plot_l = x_axis.PixelsToPlot (plot.PlotRect .Min .x - IO.MouseDelta .x );
19451945 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);
19481947 if (axis_equal && x_axis.OrthoAxis != nullptr )
19491948 x_axis.OrthoAxis ->SetAspect (x_axis.GetAspect ());
19501949 changed = true ;
@@ -1959,8 +1958,7 @@ bool UpdateInput(ImPlotPlot& plot) {
19591958 if (IO.MouseDelta .y != 0 && !y_axis.IsPanLocked (increasing)) {
19601959 const double plot_t = y_axis.PixelsToPlot (plot.PlotRect .Min .y - IO.MouseDelta .y );
19611960 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 );
19641962 if (axis_equal && y_axis.OrthoAxis != nullptr )
19651963 y_axis.OrthoAxis ->SetAspect (y_axis.GetAspect ());
19661964 changed = true ;
@@ -1995,36 +1993,30 @@ bool UpdateInput(ImPlotPlot& plot) {
19951993 const bool equal_zoom = axis_equal && x_axis.OrthoAxis != nullptr ;
19961994 const bool equal_locked = (equal_zoom != false ) && x_axis.OrthoAxis ->IsInputLocked ();
19971995 if (x_hov[i] && !x_axis.IsInputLocked () && !equal_locked) {
1998- ImGui::SetKeyOwner (ImGuiKey_MouseWheelY, plot.ID );
19991996 if (zoom_rate != 0 .0f ) {
20001997 float correction = (plot.Hovered && equal_zoom) ? 0 .5f : 1 .0f ;
20011998 const double plot_l = x_axis.PixelsToPlot (plot.PlotRect .Min .x - rect_size.x * tx * zoom_rate * correction);
20021999 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);
20052001 if (axis_equal && x_axis.OrthoAxis != nullptr )
20062002 x_axis.OrthoAxis ->SetAspect (x_axis.GetAspect ());
20072003 changed = true ;
20082004 }
2009- }
20102005 }
20112006 for (int i = 0 ; i < IMPLOT_NUM_Y_AXES; i++) {
20122007 ImPlotAxis& y_axis = plot.YAxis (i);
20132008 const bool equal_zoom = axis_equal && y_axis.OrthoAxis != nullptr ;
20142009 const bool equal_locked = equal_zoom && y_axis.OrthoAxis ->IsInputLocked ();
20152010 if (y_hov[i] && !y_axis.IsInputLocked () && !equal_locked) {
2016- ImGui::SetKeyOwner (ImGuiKey_MouseWheelY, plot.ID );
20172011 if (zoom_rate != 0 .0f ) {
20182012 float correction = (plot.Hovered && equal_zoom) ? 0 .5f : 1 .0f ;
20192013 const double plot_t = y_axis.PixelsToPlot (plot.PlotRect .Min .y - rect_size.y * ty * zoom_rate * correction);
20202014 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);
20232016 if (axis_equal && y_axis.OrthoAxis != nullptr )
20242017 y_axis.OrthoAxis ->SetAspect (y_axis.GetAspect ());
20252018 changed = true ;
20262019 }
2027- }
20282020 }
20292021 }
20302022
@@ -2041,8 +2033,7 @@ bool UpdateInput(ImPlotPlot& plot) {
20412033 if (!x_axis.IsInputLocked () && x_can_change) {
20422034 const double p1 = x_axis.PixelsToPlot (plot.SelectStart .x );
20432035 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));
20462037 changed = true ;
20472038 }
20482039 }
@@ -2051,8 +2042,7 @@ bool UpdateInput(ImPlotPlot& plot) {
20512042 if (!y_axis.IsInputLocked () && y_can_change) {
20522043 const double p1 = y_axis.PixelsToPlot (plot.SelectStart .y );
20532044 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));
20562046 changed = true ;
20572047 }
20582048 }
0 commit comments