Fix mousewheel issue

This commit is contained in:
SoniEx2 2019-02-12 21:31:12 -02:00
parent 3fcdf3a76d
commit b2681f9f5d
1 changed files with 11 additions and 11 deletions

View File

@ -102,10 +102,16 @@ local function markupdated(pos, redraw)
end end
end end
local function change_val(amt)
for i=math.min(visual_start or cp, cp), math.max(visual_start or cp, cp) do
imgt[i] = math.max(math.min(imgt[i] + amt, PAL_MAX), 0)
markupdated(i, true)
end
end
function love.wheelmoved(x, y) function love.wheelmoved(x, y)
saved = nil saved = nil
imgt[cp] = math.min(math.max(imgt[cp]+y, 0), PAL_MAX) change_val(y)
markupdated(cp, true)
end end
function setback(pos, highlight) function setback(pos, highlight)
@ -196,19 +202,13 @@ function love.update(dt)
end end
local function decr() local function decr()
saved = nil saved = nil
local amt = (kt['lshift'] and 16 or 1) local amt = -(kt['lshift'] and 16 or 1)
for i=math.min(visual_start or cp, cp), math.max(visual_start or cp, cp) do change_val(amt)
imgt[i] = math.max(imgt[i] - amt, 0)
markupdated(i, true)
end
end end
local function incr() local function incr()
saved = nil saved = nil
local amt = (kt['lshift'] and 16 or 1) local amt = (kt['lshift'] and 16 or 1)
for i=math.min(visual_start or cp, cp), math.max(visual_start or cp, cp) do change_val(amt)
imgt[i] = math.min(imgt[i] + amt, PAL_MAX)
markupdated(i, true)
end
end end
local function light_propagation_up() local function light_propagation_up()
if visual_start then if visual_start then