Fix the alignment of the control panel when resizing
authorAlexander Ebert <ebert@woltlab.com>
Mon, 26 Aug 2024 12:53:26 +0000 (14:53 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 26 Aug 2024 12:53:26 +0000 (14:53 +0200)
See https://www.woltlab.com/community/thread/307876-ge%C3%B6ffnetes-kontrollzentrum-verschiebt-sich-wenn-ich-das-fenster-kleiner-mache-au/

ts/WoltLabSuite/Core/Ui/User/Menu/ControlPanel.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/User/Menu/ControlPanel.js

index b8e444ecc5c3dd56fcb67d4fcd0695e727e812f5..3a4c2a22d6bc9423300479c465f2691730544a53 100644 (file)
@@ -70,6 +70,18 @@ export function setup(): void {
 
     element.addEventListener("click", (event) => event.stopPropagation());
 
+    window.addEventListener(
+      "resize",
+      () => {
+        if (element.hidden) {
+          return;
+        }
+
+        setAlignment(element, button);
+      },
+      { passive: true },
+    );
+
     button.addEventListener("click", (event) => {
       event.preventDefault();
       event.stopPropagation();
index b943affac819ca3fd64694a5e6cbe784222cece0..a24ee2dd26f6eab925e0ee6c324c94ad74f91b81 100644 (file)
@@ -55,6 +55,12 @@ define(["require", "exports", "tslib", "../../CloseOverlay", "./Manager", "focus
             CloseOverlay_1.default.add("WoltLabSuite/Core/Ui/User/Menu/ControlPanel", () => close());
             (0, Manager_1.getContainer)().append(element);
             element.addEventListener("click", (event) => event.stopPropagation());
+            window.addEventListener("resize", () => {
+                if (element.hidden) {
+                    return;
+                }
+                setAlignment(element, button);
+            }, { passive: true });
             button.addEventListener("click", (event) => {
                 event.preventDefault();
                 event.stopPropagation();