| 3666 | } |
| 3667 | |
| 3668 | ImPlotPoint PixelsToPlot(float x, float y, ImAxis x_idx, ImAxis y_idx) { |
| 3669 | ImPlotContext& gp = *GImPlot; |
| 3670 | IM_ASSERT_USER_ERROR(gp.CurrentPlot != nullptr, "PixelsToPlot() needs to be called between BeginPlot() and EndPlot()!"); |
| 3671 | IM_ASSERT_USER_ERROR(x_idx == IMPLOT_AUTO || (x_idx >= ImAxis_X1 && x_idx < ImAxis_Y1), "X-Axis index out of bounds!"); |
| 3672 | IM_ASSERT_USER_ERROR(y_idx == IMPLOT_AUTO || (y_idx >= ImAxis_Y1 && y_idx < ImAxis_COUNT), "Y-Axis index out of bounds!"); |
| 3673 | SetupLock(); |
| 3674 | ImPlotPlot& plot = *gp.CurrentPlot; |
| 3675 | ImPlotAxis& x_axis = x_idx == IMPLOT_AUTO ? plot.Axes[plot.CurrentX] : plot.Axes[x_idx]; |
| 3676 | ImPlotAxis& y_axis = y_idx == IMPLOT_AUTO ? plot.Axes[plot.CurrentY] : plot.Axes[y_idx]; |
| 3677 | return ImPlotPoint( x_axis.PixelsToPlot(x), y_axis.PixelsToPlot(y) ); |
| 3678 | } |
| 3679 | |
| 3680 | ImPlotPoint PixelsToPlot(const ImVec2& pix, ImAxis x_idx, ImAxis y_idx) { |
| 3681 | return PixelsToPlot(pix.x, pix.y, x_idx, y_idx); |
no test coverage detected