MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / ComputeBoundingBox

Method ComputeBoundingBox

Source/Minimap.cpp:62–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62void Minimap::ComputeBoundingBox(ofRectangle& rect)
63{
64 std::vector<IDrawableModule*> modules;
65 TheSynth->GetRootContainer()->GetAllModules(modules);
66
67 if (modules.empty())
68 {
69 rect = TheSynth->GetDrawRect();
70 return;
71 }
72
73 rect = modules[0]->GetRect();
74
75 for (int i = 1; i < modules.size(); ++i)
76 {
77 if (!modules[i]->IsShowing())
78 {
79 continue;
80 }
81 ofRectangle moduleRect = modules[i]->GetRect();
82 RectUnion(rect, moduleRect);
83 }
84
85 float minimapWidth, minimapHeight;
86 GetDimensionsMinimap(minimapWidth, minimapHeight);
87 float boundsAspectRatio = rect.width / rect.height;
88 float minimapAspectRatio = minimapWidth / minimapHeight;
89 //retain aspect ratio
90 if (boundsAspectRatio > minimapAspectRatio)
91 rect.height = rect.width / minimapAspectRatio;
92 else
93 rect.width = rect.height * minimapAspectRatio;
94}
95
96ofRectangle Minimap::CoordsToMinimap(ofRectangle& boundingBox, ofRectangle& source)
97{

Callers

nothing calls this directly

Calls 6

GetRootContainerMethod · 0.80
emptyMethod · 0.80
sizeMethod · 0.80
IsShowingMethod · 0.80
GetAllModulesMethod · 0.45
GetRectMethod · 0.45

Tested by

no test coverage detected