From d87512353495e7760e7fda7566a05beef7627d8f Mon Sep 17 00:00:00 2001 From: Evan Pezent Date: Fri, 25 Nov 2022 09:31:58 -0600 Subject: [PATCH] make PlotText honor ImPlotItemFlags_NoFit --- implot_items.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/implot_items.cpp b/implot_items.cpp index 1fbdf5b..72811ee 100644 --- a/implot_items.cpp +++ b/implot_items.cpp @@ -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)); } @@ -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)); }