summaryrefslogtreecommitdiff
path: root/ui/windows
diff options
context:
space:
mode:
Diffstat (limited to 'ui/windows')
-rw-r--r--ui/windows/plot_window.py11
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]: