[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.
This commit is contained in:
jgmdev 2021-06-17 20:58:22 -04:00
parent 5151e36981
commit e9e1214e59
1 changed files with 7 additions and 4 deletions

View File

@ -32,6 +32,9 @@ local function set_scale(scale)
local s = scale / current_scale local s = scale / current_scale
current_scale = 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 if config.scale_mode == "ui" then
SCALE = scale SCALE = scale
@ -58,7 +61,7 @@ local function set_scale(scale)
core.redraw = true core.redraw = true
end end
local function get_scale() local function get_scale()
return current_scale return current_scale
end end
@ -101,9 +104,9 @@ keymap.add {
["ctrl+="] = "scale:increase", ["ctrl+="] = "scale:increase",
} }
return { return {
["set"] = set_scale, ["set"] = set_scale,
["get"] = get_scale, ["get"] = get_scale,
["increase"] = inc_scale, ["increase"] = inc_scale,
["decrease"] = dec_scale, ["decrease"] = dec_scale,
["reset"] = res_scale ["reset"] = res_scale