fix: Check minSize constraints before resizing (#14931)
* Inital setSize check * Only resize if above minimum size constraints * lint * Resize to min if size is changed * Remove unneeded if statement * chore: remove trailing whitespace * Add note about setSize method in docs
This commit is contained in:
parent
532ee2dadf
commit
d678d9ee75
2 changed files with 4 additions and 2 deletions
|
@ -403,8 +403,10 @@ gfx::Rect TopLevelWindow::GetContentBounds() {
|
||||||
|
|
||||||
void TopLevelWindow::SetSize(int width, int height, mate::Arguments* args) {
|
void TopLevelWindow::SetSize(int width, int height, mate::Arguments* args) {
|
||||||
bool animate = false;
|
bool animate = false;
|
||||||
|
gfx::Size size = window_->GetMinimumSize();
|
||||||
|
size.SetToMax(gfx::Size(width, height));
|
||||||
args->GetNext(&animate);
|
args->GetNext(&animate);
|
||||||
window_->SetSize(gfx::Size(width, height), animate);
|
window_->SetSize(size, animate);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int> TopLevelWindow::GetSize() {
|
std::vector<int> TopLevelWindow::GetSize() {
|
||||||
|
|
|
@ -920,7 +920,7 @@ Disable or enable the window.
|
||||||
* `height` Integer
|
* `height` Integer
|
||||||
* `animate` Boolean (optional) _macOS_
|
* `animate` Boolean (optional) _macOS_
|
||||||
|
|
||||||
Resizes the window to `width` and `height`.
|
Resizes the window to `width` and `height`. If `width` or `height` are below any set minimum size constraints the window will snap to its minimum size.
|
||||||
|
|
||||||
#### `win.getSize()`
|
#### `win.getSize()`
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue