Skip to content

Commit 636fa42

Browse files
authored
Merge pull request #2630 from kikora/codex/add-padding-for-first-quadrant-display
Add padding for first quadrant arrows
2 parents 1df2e6f + b2dfd12 commit 636fa42

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

graftegner.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2446,6 +2446,21 @@ function clampScreenToFirstQuadrant(screen) {
24462446
const fallback = Math.max(Math.abs(ymax - ymin), 1);
24472447
ymax = ymin + fallback;
24482448
}
2449+
2450+
const FIRST_QUADRANT_PAD_RATIO = 0.04;
2451+
const FIRST_QUADRANT_PAD_CAP_RATIO = 0.25;
2452+
const spanX = xmax - xmin;
2453+
const spanY = ymax - ymin;
2454+
const padLeft = Math.min(
2455+
Math.max(spanX * FIRST_QUADRANT_PAD_RATIO, 0.5),
2456+
Math.max(spanX * FIRST_QUADRANT_PAD_CAP_RATIO, 0)
2457+
);
2458+
const padBottom = Math.min(
2459+
Math.max(spanY * FIRST_QUADRANT_PAD_RATIO, 0.5),
2460+
Math.max(spanY * FIRST_QUADRANT_PAD_CAP_RATIO, 0)
2461+
);
2462+
xmin -= padLeft;
2463+
ymin -= padBottom;
24492464
return [xmin, xmax, ymin, ymax];
24502465
}
24512466

0 commit comments

Comments
 (0)