mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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;
|
return position;
|
||||||
}
|
}
|
||||||
const auto scaleFactor = cScale() / float64(position.scale);
|
const auto scaleFactor = cScale() / float64(position.scale);
|
||||||
position.x *= scaleFactor;
|
if (scaleFactor != 1.) {
|
||||||
position.y *= scaleFactor;
|
// Change scale while keeping the position center in place.
|
||||||
position.w *= scaleFactor;
|
position.x += position.w / 2;
|
||||||
position.h *= scaleFactor;
|
position.y += position.h / 2;
|
||||||
|
position.w *= scaleFactor;
|
||||||
|
position.h *= scaleFactor;
|
||||||
|
position.x -= position.w / 2;
|
||||||
|
position.y -= position.h / 2;
|
||||||
|
}
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue