diff --git a/src/app/GUI/mainwindow.cpp b/src/app/GUI/mainwindow.cpp index 2b5c68ee8..42f2e5ef3 100644 --- a/src/app/GUI/mainwindow.cpp +++ b/src/app/GUI/mainwindow.cpp @@ -499,6 +499,15 @@ void MainWindow::setupDocument() if (mTimeline) { mTimeline->stopPreview(); } }); +#ifdef Q_OS_MAC + // https://github.com/friction2d/friction/pull/736 + connect(&mDocument, &Document::fitCanvasToSize, this, []() { + const auto target = KeyFocusTarget::KFT_getCurrentTarget(); + const auto cwTarget = dynamic_cast(target); + if (cwTarget) { cwTarget->fitCanvasToSize(); } + }); +#endif + // set defaults mDocument.setPath(""); mDocument.fDrawPathManual = false; diff --git a/src/core/Private/document.h b/src/core/Private/document.h index 4f1d8b126..992e0a032 100644 --- a/src/core/Private/document.h +++ b/src/core/Private/document.h @@ -258,6 +258,9 @@ class CORE_EXPORT Document : public SingleWidgetTarget { void openApplyExpressionDialog(QrealAnimator* const target); void newVideo(const VideoBox::VideoSpecs specs); void currentPixelColor(const QColor &color); + + // https://github.com/friction2d/friction/pull/736 + void fitCanvasToSize(); }; #endif // DOCUMENT_H diff --git a/src/ui/dialogs/scenesettingsdialog.cpp b/src/ui/dialogs/scenesettingsdialog.cpp index 7403fb555..b22343bff 100644 --- a/src/ui/dialogs/scenesettingsdialog.cpp +++ b/src/ui/dialogs/scenesettingsdialog.cpp @@ -369,6 +369,10 @@ void SceneSettingsDialog::sNewSceneDialog(Document& document, newCanvas->anim_setAbsFrame(newCanvas->getFrameRange().fMin); dialog->close(); docPtr->actionFinished(); +#ifdef Q_OS_MAC + // https://github.com/friction2d/friction/pull/736 + emit docPtr->fitCanvasToSize(); +#endif }); dialog->show();