| 60 | } |
| 61 | |
| 62 | void 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 | |
| 96 | ofRectangle Minimap::CoordsToMinimap(ofRectangle& boundingBox, ofRectangle& source) |
| 97 | { |
nothing calls this directly
no test coverage detected