diff options
| author | Christian Kolset <christian.kolset@gmail.com> | 2026-06-03 16:40:11 -0600 |
|---|---|---|
| committer | Christian Kolset <christian.kolset@gmail.com> | 2026-06-03 16:40:11 -0600 |
| commit | 7651f515728533506391e6cc719fe8ff32c339e7 (patch) | |
| tree | 892c6497bd24731e4a58692dd2003f443a202b56 /ui/windows | |
| parent | f60de21eeaa50f847108a9c103934cc8da7352fb (diff) | |
Fix horizontal zone detection for wide/short tiles
_zone_at used absolute pixel distance to pick dominant axis, which always
favoured the short (vertical) axis for landscape tiles. Replaced with
normalized fraction (dist/dimension), so left/right zones are accessible
on wide tiles.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'ui/windows')
| -rw-r--r-- | ui/windows/plot_window.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ui/windows/plot_window.py b/ui/windows/plot_window.py index 15d509b..f929261 100644 --- a/ui/windows/plot_window.py +++ b/ui/windows/plot_window.py @@ -631,17 +631,18 @@ class LayoutCanvas(QFrame): elif ry > h - sp_h: y_zone = "split_bottom" else: y_zone = "center" - # Pick dominant axis (nearest edge wins; center loses to any edge) + # Pick dominant axis: normalize by dimension so wide/short tiles + # don't always favour the short axis if x_zone == "center" and y_zone == "center": return (pane_idx, "center") if x_zone == "center": return (pane_idx, y_zone) if y_zone == "center": return (pane_idx, x_zone) - # Both non-center: whichever is closer to the edge - dx = min(rx, w - rx) - dy = min(ry, h - ry) - return (pane_idx, x_zone if dx <= dy else y_zone) + # Both non-center: fractional distance from nearest edge decides + x_frac = min(rx, w - rx) / max(w, 1) + y_frac = min(ry, h - ry) / max(h, 1) + return (pane_idx, x_zone if x_frac <= y_frac else y_zone) return None def _adjacent_tile(self, pane_idx: int, direction: str) -> Optional[int]: |
