[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
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