mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 07:37:11 +02:00
Apply scale keeping window center in place.
This commit is contained in:
parent
de9b21e436
commit
703ea9aacd
1 changed files with 9 additions and 4 deletions
|
@ -445,10 +445,15 @@ Core::WindowPosition MainWindow::positionFromSettings() const {
|
|||
return position;
|
||||
}
|
||||
const auto scaleFactor = cScale() / float64(position.scale);
|
||||
position.x *= scaleFactor;
|
||||
position.y *= scaleFactor;
|
||||
position.w *= scaleFactor;
|
||||
position.h *= scaleFactor;
|
||||
if (scaleFactor != 1.) {
|
||||
// Change scale while keeping the position center in place.
|
||||
position.x += position.w / 2;
|
||||
position.y += position.h / 2;
|
||||
position.w *= scaleFactor;
|
||||
position.h *= scaleFactor;
|
||||
position.x -= position.w / 2;
|
||||
position.y -= position.h / 2;
|
||||
}
|
||||
return position;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue