I’m trying to limit a resizable window to a fixed aspect ratio. I tried modifying the DemoRunner’s WindowsDemo::showDocumentWindow to use the simple BorderBoundsConstrainer class from here: Resizing a window with native titlebar and fixed aspect ratio
I added this to the end of showDocumentWindow
BorderBoundsConstrainer* constrainer = new BorderBoundsConstrainer(); constrainer->SetBorder(native ? dw->getPeer()->getFrameSize() : dw->getContentComponentBorder()); constrainer->setFixedAspectRatio(originalWidth/originalHeight); dw->setConstrainer(constrainer);
When dragging the corner resizer, it works reasonably well for the native title bar case, but behaves very strangely (window position jumping around), when using the non-native titlebar.
Is there some other way I should be doing this?