From 9e8419fea7bd5b5cc2c25f328cf4a4db440ca075 Mon Sep 17 00:00:00 2001 From: RomainFT Date: Sun, 22 Jan 2023 19:30:38 +0100 Subject: [PATCH] text tool #458 #357 wide-enough margin regardless of the zoom level --- src/utilities/utilities_overlay.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utilities/utilities_overlay.py b/src/utilities/utilities_overlay.py index 698be942..02aa006a 100644 --- a/src/utilities/utilities_overlay.py +++ b/src/utilities/utilities_overlay.py @@ -14,7 +14,8 @@ def utilities_show_composite_overlay(ccontext, thickness=1, x_press=None, y_pres x1, y1, x2, y2 = ccontext.path_extents() radius = _get_radius((x2 - x1), (y2 - y1), thickness) - radius_with_margin = (radius + 10) * 1.2 + # Empirical way to get a wide-enough margin regardless of the zoom level + radius_with_margin = (radius + 13 * thickness) * 1.2 ccontext.move_to(x1 - radius_with_margin, y1 - radius_with_margin) ccontext.line_to(x2 + radius_with_margin, y1 - radius_with_margin) ccontext.line_to(x2 + radius_with_margin, y2 + radius_with_margin)