From e9e1214e5959303cd87aa61e127fac6ebd1bc270 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Thu, 17 Jun 2021 20:58:22 -0400 Subject: [PATCH] [plugin/scale] fixed wrong increase and decrease If the user manually set the desired scale by calling scale.set(1.60) the scale_level was not set accordingly which meant that later doing a Scale:Increase/Decrease command yielded incorrect scale amount. --- data/plugins/scale.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/data/plugins/scale.lua b/data/plugins/scale.lua index 5a1a69bd..a5f5aaee 100644 --- a/data/plugins/scale.lua +++ b/data/plugins/scale.lua @@ -32,6 +32,9 @@ local function set_scale(scale) local s = scale / current_scale current_scale = scale + -- we set scale_level in case this was called by user + scale_level = (scale - default_scale) / scale_steps + if config.scale_mode == "ui" then SCALE = scale @@ -58,7 +61,7 @@ local function set_scale(scale) core.redraw = true end -local function get_scale() +local function get_scale() return current_scale end @@ -101,9 +104,9 @@ keymap.add { ["ctrl+="] = "scale:increase", } -return { - ["set"] = set_scale, - ["get"] = get_scale, +return { + ["set"] = set_scale, + ["get"] = get_scale, ["increase"] = inc_scale, ["decrease"] = dec_scale, ["reset"] = res_scale