| 592 | //----------------------------------------------------------------------------- |
| 593 | |
| 594 | ImVec2 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 | |
| 614 | ImVec2 CalcLegendSize(ImPlotItemGroup& items, const ImVec2& pad, const ImVec2& spacing, bool vertical) { |
| 615 | // vars |
no test coverage detected