Skip to content

Commit

Permalink
make PlotText honor ImPlotItemFlags_NoFit
Browse files Browse the repository at this point in the history
  • Loading branch information
epezent committed Nov 25, 2022
1 parent fcb51d2 commit d875123
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions implot_items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2656,7 +2656,7 @@ void PlotText(const char* text, double x, double y, const ImVec2& pixel_offset,
ImVec2 siz = CalcTextSizeVertical(text) * 0.5f;
ImVec2 ctr = siz * 0.5f;
ImVec2 pos = PlotToPixels(ImPlotPoint(x,y),IMPLOT_AUTO,IMPLOT_AUTO) + ImVec2(-ctr.x, ctr.y) + pixel_offset;
if (FitThisFrame()) {
if (FitThisFrame() && !ImHasFlag(flags, ImPlotItemFlags_NoFit)) {
FitPoint(PixelsToPlot(pos));
FitPoint(PixelsToPlot(pos.x + siz.x, pos.y - siz.y));
}
Expand All @@ -2665,7 +2665,7 @@ void PlotText(const char* text, double x, double y, const ImVec2& pixel_offset,
else {
ImVec2 siz = ImGui::CalcTextSize(text);
ImVec2 pos = PlotToPixels(ImPlotPoint(x,y),IMPLOT_AUTO,IMPLOT_AUTO) - siz * 0.5f + pixel_offset;
if (FitThisFrame()) {
if (FitThisFrame() && !ImHasFlag(flags, ImPlotItemFlags_NoFit)) {
FitPoint(PixelsToPlot(pos));
FitPoint(PixelsToPlot(pos+siz));
}
Expand Down

0 comments on commit d875123

Please sign in to comment.