Refactored minimum scale bug fix code

This commit is contained in:
Daniel Rocha 2021-08-27 23:57:51 -03:00 committed by Francesco Abbate
parent 49ec7c88e8
commit 2b1c157a36
1 changed files with 3 additions and 10 deletions

View File

@ -13,7 +13,7 @@ config.plugins.scale = {
use_mousewheel = true
}
local MIN_SCALE = 0.25;
local MINIMUM_SCALE = 0.25;
local scale_level = 0
local scale_steps = 0.05
@ -91,15 +91,8 @@ local function inc_scale()
end
local function dec_scale()
local new_scale_level = default_scale + (scale_level - 1) * scale_steps
if new_scale_level < MIN_SCALE then
set_scale(MIN_SCALE)
return
end
scale_level = scale_level - 1
set_scale(default_scale + scale_level * scale_steps)
set_scale(math.max(default_scale + scale_level * scale_steps), MINIMUM_SCALE)
end