7 const Rectangle<int>& limits,
8 bool stretching_top,
bool stretching_left,
9 bool stretching_bottom,
bool stretching_right) {
12 double aspect_ratio = getFixedAspectRatio();
15 ComponentBoundsConstrainer::checkBounds(bounds, previous, limits,
16 stretching_top, stretching_left,
17 stretching_bottom, stretching_right);
20 Rectangle<int> display_area = Desktop::getInstance().getDisplays().getTotalBounds(
true);
22 ComponentPeer* peer =
gui_->getPeer();
24 peer->getFrameSize().subtractFrom(display_area);
28 if (display_area.getWidth() < bounds.getWidth()) {
29 int new_width = display_area.getWidth();
30 int new_height = std::round(new_width / aspect_ratio);
31 bounds.setWidth(new_width);
32 bounds.setHeight(new_height);
36 if (display_area.getHeight() < bounds.getHeight()) {
37 int new_height = display_area.getHeight();
38 int new_width = std::round(new_height * aspect_ratio);
39 bounds.setWidth(new_width);
40 bounds.setHeight(new_height);
virtual void resizeEnd() override
Called after a resize operation finishes.
Definition border_bounds_constrainer.cpp:53
FullInterface * gui_
A pointer to the associated GUI interface, which may be nullptr if none is set.
Definition border_bounds_constrainer.h:79
virtual void resizeStart() override
Called before a resize operation begins.
Definition border_bounds_constrainer.cpp:47
virtual void checkBounds(Rectangle< int > &bounds, const Rectangle< int > &previous, const Rectangle< int > &limits, bool stretching_top, bool stretching_left, bool stretching_bottom, bool stretching_right) override
Adjusts the given bounds to enforce border constraints, maintain aspect ratio, and limit the window s...
Definition border_bounds_constrainer.cpp:6
BorderSize< int > border_
The border to be applied to the component bounds.
Definition border_bounds_constrainer.h:84
void enableRedoBackground(bool enable)
Enables or disables redrawing of the background when resized.
Definition full_interface.h:482
static void saveWindowSize(float window_size)
Saves the window size scaling factor.
Definition load_save.cpp:1324
constexpr int kDefaultWindowWidth
Default width of the Vital window (in pixels).
Definition synth_constants.h:61