client/options/keep content centered: simplify the inner workings

This commit is contained in:
Adorian Doran
2025-11-07 21:15:51 +02:00
parent c617c84d86
commit 9bccc72668
5 changed files with 17 additions and 16 deletions

View File

@@ -69,13 +69,9 @@ export default class RootContainer extends FlexContainer<BasicWidget> {
#setMaxContentWidth() {
const width = Math.max(options.getInt("maxContentWidth") || 0, 640);
const centerContent = options.is("centerContent");
document.body.style.setProperty("--preferred-max-content-width", `${width}px`);
// To center the content, "--preferred-content-margin-inline" should be set to "auto".
document.body.style.setProperty("--preferred-content-margin-inline",
(centerContent) ? "auto" : "unset");
document.body.classList.toggle("prefers-centered-content", options.is("centerContent"));
}
#setMotion() {