mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 22:25:12 +00:00
Apply scale keeping window center in place.
This commit is contained in:
@@ -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.x += position.w / 2;
|
||||||
|
position.y += position.h / 2;
|
||||||
position.w *= scaleFactor;
|
position.w *= scaleFactor;
|
||||||
position.h *= scaleFactor;
|
position.h *= scaleFactor;
|
||||||
|
position.x -= position.w / 2;
|
||||||
|
position.y -= position.h / 2;
|
||||||
|
}
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user