| 2173 | } |
| 2174 | |
| 2175 | Vector2f ImageViewer::sizeToFitImage(const shared_ptr<Image>& image) { |
| 2176 | if (!image) { |
| 2177 | return m_size; |
| 2178 | } |
| 2179 | |
| 2180 | // Convert from image pixel coordinates to nanogui coordinates. |
| 2181 | auto requiredSize = Vector2f{image->displaySize()} / pixel_ratio(); |
| 2182 | |
| 2183 | // Take into account the size of the UI. |
| 2184 | if (mSidebar->visible()) { |
| 2185 | requiredSize.x() += mSidebar->fixed_width(); |
| 2186 | } |
| 2187 | |
| 2188 | if (mFooter->visible()) { |
| 2189 | requiredSize.y() += mFooter->fixed_height(); |
| 2190 | } |
| 2191 | |
| 2192 | return requiredSize; |
| 2193 | } |
| 2194 | |
| 2195 | Vector2f ImageViewer::sizeToFitAllImages() { |
| 2196 | Vector2f result = m_size; |
nothing calls this directly
no test coverage detected