From 7651f515728533506391e6cc719fe8ff32c339e7 Mon Sep 17 00:00:00 2001 From: Christian Kolset Date: Wed, 3 Jun 2026 16:40:11 -0600 Subject: 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 --- ui/windows/plot_window.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'ui/windows') 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]: -- cgit v1.2.3