MCPcopy Create free account
hub / github.com/SatDump/SatDump / GetLocationPos

Function GetLocationPos

src-core/imgui/implot/implot.cpp:548–566  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

546//-----------------------------------------------------------------------------
547
548ImVec2 GetLocationPos(const ImRect& outer_rect, const ImVec2& inner_size, ImPlotLocation loc, const ImVec2& pad) {
549 ImVec2 pos;
550 if (ImHasFlag(loc, ImPlotLocation_West) && !ImHasFlag(loc, ImPlotLocation_East))
551 pos.x = outer_rect.Min.x + pad.x;
552 else if (!ImHasFlag(loc, ImPlotLocation_West) && ImHasFlag(loc, ImPlotLocation_East))
553 pos.x = outer_rect.Max.x - pad.x - inner_size.x;
554 else
555 pos.x = outer_rect.GetCenter().x - inner_size.x * 0.5f;
556 // legend reference point y
557 if (ImHasFlag(loc, ImPlotLocation_North) && !ImHasFlag(loc, ImPlotLocation_South))
558 pos.y = outer_rect.Min.y + pad.y;
559 else if (!ImHasFlag(loc, ImPlotLocation_North) && ImHasFlag(loc, ImPlotLocation_South))
560 pos.y = outer_rect.Max.y - pad.y - inner_size.y;
561 else
562 pos.y = outer_rect.GetCenter().y - inner_size.y * 0.5f;
563 pos.x = IM_ROUND(pos.x);
564 pos.y = IM_ROUND(pos.y);
565 return pos;
566}
567
568ImVec2 CalcLegendSize(ImPlotItemGroup& items, const ImVec2& pad, const ImVec2& spacing, bool vertical) {
569 // vars

Callers 3

EndPlotFunction · 0.85
EndSubplotsFunction · 0.85
ShowAltLegendFunction · 0.85

Calls 2

ImHasFlagFunction · 0.85
GetCenterMethod · 0.80

Tested by

no test coverage detected