MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / GetLocationPos

Function GetLocationPos

Source/3rdParty/implot/implot.cpp:594–612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

592//-----------------------------------------------------------------------------
593
594ImVec2 GetLocationPos(const ImRect& outer_rect, const ImVec2& inner_size, ImPlotLocation loc, const ImVec2& pad) {
595 ImVec2 pos;
596 if (ImHasFlag(loc, ImPlotLocation_West) && !ImHasFlag(loc, ImPlotLocation_East))
597 pos.x = outer_rect.Min.x + pad.x;
598 else if (!ImHasFlag(loc, ImPlotLocation_West) && ImHasFlag(loc, ImPlotLocation_East))
599 pos.x = outer_rect.Max.x - pad.x - inner_size.x;
600 else
601 pos.x = outer_rect.GetCenter().x - inner_size.x * 0.5f;
602 // legend reference point y
603 if (ImHasFlag(loc, ImPlotLocation_North) && !ImHasFlag(loc, ImPlotLocation_South))
604 pos.y = outer_rect.Min.y + pad.y;
605 else if (!ImHasFlag(loc, ImPlotLocation_North) && ImHasFlag(loc, ImPlotLocation_South))
606 pos.y = outer_rect.Max.y - pad.y - inner_size.y;
607 else
608 pos.y = outer_rect.GetCenter().y - inner_size.y * 0.5f;
609 pos.x = IM_ROUND(pos.x);
610 pos.y = IM_ROUND(pos.y);
611 return pos;
612}
613
614ImVec2 CalcLegendSize(ImPlotItemGroup& items, const ImVec2& pad, const ImVec2& spacing, bool vertical) {
615 // 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