diff --git a/presentation/shell/nav_rail.py b/presentation/shell/nav_rail.py index eb4b9a4..a6168bb 100644 --- a/presentation/shell/nav_rail.py +++ b/presentation/shell/nav_rail.py @@ -351,10 +351,18 @@ class NavRailMixin: self._nav_wrap.setMaximumWidth(hi) def _on_split_moved(self, _pos: int, _index: int) -> None: - """Người dùng kéo thanh chia: nhớ lại bề rộng thanh menu để lần mở sau giữ nguyên.""" + """Người dùng kéo thanh chia: nhớ lại bề rộng thanh menu để lần mở sau giữ nguyên. + + Nếu kéo xuống dưới ngưỡng collapsed, tự động chuyển sang chế độ icon-only + thay vì để width = 0 (khiến toggle button biến mất và không thể mở lại). + """ + w = self._nav_wrap.width() + if w <= _NAV_COLLAPSED_WIDTH and not self._nav_collapsed: + self._toggle_nav() + return if not self._nav_collapsed: self._nav_width = max(_NAV_MIN_WIDTH, - min(self._nav_max_width(), self._nav_wrap.width())) + min(self._nav_max_width(), w)) def _toggle_nav(self) -> None: """Thu gọn / mở rộng thanh menu, nhớ bề rộng trước khi thu để khôi phục đúng.""" diff --git a/presentation/shell/rail_metrics.py b/presentation/shell/rail_metrics.py index f1e478b..ecc6afc 100644 --- a/presentation/shell/rail_metrics.py +++ b/presentation/shell/rail_metrics.py @@ -15,7 +15,7 @@ _NAV_EXPANDED_WIDTH = 150 _NAV_COLLAPSED_WIDTH = 54 _NAV_ROW_INSET = 8 _NAV_ROW_GAP = 6 -_NAV_MIN_WIDTH = 132 +_NAV_MIN_WIDTH = 54 _NAV_MAX_SHARE = 0.22 _NAV_MAX_CEILING = 360