Răsfoiți Sursa

pin dock and cc to screen edges

Milan Jurkulak 3 luni în urmă
părinte
comite
fef021bcde

+ 4 - 0
shared/src/desktopMain/kotlin/org/mjdev/desktop/components/controlcenter/ControlCenterWindow.kt

@@ -127,6 +127,10 @@ fun ControlCenterWindow(
         )
         LaunchedEffect(position, size) {
             controlCenterState.size = size
+            // Deterministic right-edge anchor — same hardening as the dock: re-pin the
+            // absolute position after every size change so moveBy drift can never leave
+            // the panel away from the screen edge.
+            controlCenterState.position = position
         }
     }
 }

+ 8 - 0
shared/src/desktopMain/kotlin/org/mjdev/desktop/components/dockbar/DockBarWindow.kt

@@ -227,6 +227,14 @@ fun DockBarWindow(
     }
     LaunchedEffect(size, position) {
         panelState.size = size
+        // Deterministic bottom anchor: the size setter's relative moveBy dance can drift
+        // when show/hide flips interleave (the bar then lands mid-screen). Re-pinning the
+        // absolute position after every size change makes the final geometry always
+        // (0, containerH - height), whatever the intermediate moves did.
+        panelState.position = DpOffset(
+            0.dp,
+            containerSize.height - size.height,
+        )
     }
 }