From e6f38a8c041ce6d444160471c59b7ee9529a08af Mon Sep 17 00:00:00 2001 From: Gerschel Date: Sat, 4 Feb 2023 15:36:41 -0800 Subject: [PATCH] fixed aspect ratio math aspect ratio change is based on larger dimension --- modules/ui.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/ui.py b/modules/ui.py index b2964768..59f00d6e 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -429,13 +429,13 @@ def aspect_ratio_list(): def aspect_ratio_resize(w, h, bttn_val): - ratio = reduce(lambda bttn_val_width, bttn_val_height: int(bttn_val_width) / int(bttn_val_height), bttn_val.split(":")) - if ratio < 1: + width, height = map(int, bttn_val.split(":")) + ratio = width / height + if w / ratio > h: return (round(h * ratio), h) - elif ratio > 1: - return (w, round(w * ratio)) else: - return [min(w,h)] * 2 + return (w, round(w / ratio)) + def get_value_for_setting(key):