| 3735 | } |
| 3736 | |
| 3737 | ImPlotPoint PixelsToPlot(float x, float y, ImAxis x_idx, ImAxis y_idx) { |
| 3738 | ImPlotContext& gp = *GImPlot; |
| 3739 | IM_ASSERT_USER_ERROR(gp.CurrentPlot != nullptr, "PixelsToPlot() needs to be called between BeginPlot() and EndPlot()!"); |
| 3740 | IM_ASSERT_USER_ERROR(x_idx == IMPLOT_AUTO || (x_idx >= ImAxis_X1 && x_idx < ImAxis_Y1), "X-Axis index out of bounds!"); |
| 3741 | IM_ASSERT_USER_ERROR(y_idx == IMPLOT_AUTO || (y_idx >= ImAxis_Y1 && y_idx < ImAxis_COUNT), "Y-Axis index out of bounds!"); |
| 3742 | SetupLock(); |
| 3743 | ImPlotPlot& plot = *gp.CurrentPlot; |
| 3744 | ImPlotAxis& x_axis = x_idx == IMPLOT_AUTO ? plot.Axes[plot.CurrentX] : plot.Axes[x_idx]; |
| 3745 | ImPlotAxis& y_axis = y_idx == IMPLOT_AUTO ? plot.Axes[plot.CurrentY] : plot.Axes[y_idx]; |
| 3746 | return ImPlotPoint( x_axis.PixelsToPlot(x), y_axis.PixelsToPlot(y) ); |
| 3747 | } |
| 3748 | |
| 3749 | ImPlotPoint PixelsToPlot(const ImVec2& pix, ImAxis x_idx, ImAxis y_idx) { |
| 3750 | return PixelsToPlot(pix.x, pix.y, x_idx, y_idx); |
no test coverage detected