Enable floating chat window resizing everywhere

Install directional hit regions in the shared window layer so floating chats can be moved and resized on every destination. Keep geometry updates in the shared manager and cover directional resizing with window host regressions.
This commit is contained in:
2026-11-13 18:00:53 +00:00
parent 5639e5cb05
commit cfd9f22f4b
4 changed files with 265 additions and 19 deletions
+53
View File
@@ -111,6 +111,59 @@ Rect fitWindowFrame(Rect rect, Size bounds, Size minSize) {
);
}
enum WindowResizeEdge { left, right, top, bottom }
/// Resizes while keeping the opposite edge anchored, then applies the same
/// bounds and minimum-size rules as a moved window.
Rect resizeWindowFrame(
Rect start,
Offset delta, {
required bool left,
required bool right,
required bool top,
required bool bottom,
required Size bounds,
required Size minSize,
}) {
var result = Rect.fromLTRB(
left ? start.left + delta.dx : start.left,
top ? start.top + delta.dy : start.top,
right ? start.right + delta.dx : start.right,
bottom ? start.bottom + delta.dy : start.bottom,
);
if (result.width < minSize.width) {
result = left
? Rect.fromLTRB(
start.right - minSize.width,
result.top,
start.right,
result.bottom,
)
: Rect.fromLTRB(
start.left,
result.top,
start.left + minSize.width,
result.bottom,
);
}
if (result.height < minSize.height) {
result = top
? Rect.fromLTRB(
result.left,
start.bottom - minSize.height,
result.right,
start.bottom,
)
: Rect.fromLTRB(
result.left,
start.top,
result.right,
start.top + minSize.height,
);
}
return fitWindowFrame(result, bounds, minSize);
}
/// [value] rounded to a whole logical pixel and kept within
/// `[minimum, limit]`.
///