From 97902a200c7412ab92be7cff8da4b00fd28326ac Mon Sep 17 00:00:00 2001 From: Isi Date: Tue, 21 Oct 2025 18:29:45 +0100 Subject: [PATCH] Fix padding calculations for edge cases Adjust padding calculations for horizontal and vertical padding, handling overflow cases. --- animationAssistantNodes.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/animationAssistantNodes.py b/animationAssistantNodes.py index 0edd9ef..2de9424 100644 --- a/animationAssistantNodes.py +++ b/animationAssistantNodes.py @@ -953,14 +953,22 @@ class ComputePadding: left = right = max(pad, 0) else: left = max(leftPadding, 0) - right = max(targetWidth - (width + leftPadding), 0) + right = targetWidth - (width + left) + if right < 0: + overflow = abs(right) + left = max(left - overflow, 0) + right = 0 if centralizeVertical: pad = int((targetHeight - height) / 2) top = bottom = max(pad, 0) else: top = max(topPadding, 0) - bottom = max(targetHeight - (height + topPadding), 0) + bottom = targetHeight - (height + top) + if bottom < 0: + overflow = abs(bottom) + top = max(top - overflow, 0) + bottom = 0 left = max(left, 0) right = max(right, 0)