diff --git a/src/apps/screenshot/ScreenshotWindow.cpp b/src/apps/screenshot/ScreenshotWindow.cpp index cc99873273..9c7e5be0f6 100644 --- a/src/apps/screenshot/ScreenshotWindow.cpp +++ b/src/apps/screenshot/ScreenshotWindow.cpp @@ -502,6 +502,21 @@ ScreenshotWindow::_CenterAndShow() void ScreenshotWindow::_UpdatePreviewPanel() { + float height = 150.0f; + + float width = (fScreenshot->Bounds().Width() / + fScreenshot->Bounds().Height()) * height; + + // to prevent a preview way too wide + if (width > 400.0f) { + width = 400.0f; + height = (fScreenshot->Bounds().Height() / + fScreenshot->Bounds().Width()) * width; + } + + fPreviewBox->SetExplicitMinSize(BSize(width, height)); + fPreviewBox->SetExplicitMaxSize(BSize(width, height)); + fPreviewBox->ClearViewBitmap(); fPreviewBox->SetViewBitmap(fScreenshot, fScreenshot->Bounds(), fPreviewBox->Bounds(), B_FOLLOW_ALL, 0);