From 8fde964e0e736a5c20bc940b94c0c4a7deed290b Mon Sep 17 00:00:00 2001 From: Insality Date: Wed, 28 May 2025 23:28:03 +0300 Subject: [PATCH] Revert "Merge pull request #311 from rigo128/fix_get_screen_aspect_koef" This reverts commit 9a0f341a6798a7a4be874e50857b5b659e7812e4, reversing changes made to 8ddb6e4e6062fbece3ad3556059139c9eba30286. Revert until fully investigated --- druid/helper.lua | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/druid/helper.lua b/druid/helper.lua index da4fbdd..ab3109a 100644 --- a/druid/helper.lua +++ b/druid/helper.lua @@ -141,23 +141,16 @@ end ---@return number stretch_x ---@return number stretch_y function M.get_screen_aspect_koef() - local gui_width = gui.get_width() - local gui_height = gui.get_height() - local gui_r = gui_width / gui_height + local window_x, window_y = window.get_size() - local window_width, window_height = window.get_size() - local window_r = window_width / window_height + local stretch_x = window_x / gui.get_width() + local stretch_y = window_y / gui.get_height() + local stretch_koef = math.min(stretch_x, stretch_y) - local w_s = 1 - local h_s = 1 + local koef_x = window_x / (stretch_koef * sys.get_config_int("display.width")) + local koef_y = window_y / (stretch_koef * sys.get_config_int("display.height")) - if gui_r < window_r then - w_s = window_r / gui_r - else - h_s = gui_r / window_r - end - - return w_s, h_s + return koef_x, koef_y end