Skip to content

Commit d875123

Browse files
committed
make PlotText honor ImPlotItemFlags_NoFit
1 parent fcb51d2 commit d875123

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

implot_items.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2656,7 +2656,7 @@ void PlotText(const char* text, double x, double y, const ImVec2& pixel_offset,
26562656
ImVec2 siz = CalcTextSizeVertical(text) * 0.5f;
26572657
ImVec2 ctr = siz * 0.5f;
26582658
ImVec2 pos = PlotToPixels(ImPlotPoint(x,y),IMPLOT_AUTO,IMPLOT_AUTO) + ImVec2(-ctr.x, ctr.y) + pixel_offset;
2659-
if (FitThisFrame()) {
2659+
if (FitThisFrame() && !ImHasFlag(flags, ImPlotItemFlags_NoFit)) {
26602660
FitPoint(PixelsToPlot(pos));
26612661
FitPoint(PixelsToPlot(pos.x + siz.x, pos.y - siz.y));
26622662
}
@@ -2665,7 +2665,7 @@ void PlotText(const char* text, double x, double y, const ImVec2& pixel_offset,
26652665
else {
26662666
ImVec2 siz = ImGui::CalcTextSize(text);
26672667
ImVec2 pos = PlotToPixels(ImPlotPoint(x,y),IMPLOT_AUTO,IMPLOT_AUTO) - siz * 0.5f + pixel_offset;
2668-
if (FitThisFrame()) {
2668+
if (FitThisFrame() && !ImHasFlag(flags, ImPlotItemFlags_NoFit)) {
26692669
FitPoint(PixelsToPlot(pos));
26702670
FitPoint(PixelsToPlot(pos+siz));
26712671
}

0 commit comments

Comments
 (0)