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
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)
saved = nil
imgt[cp] = math.min(math.max(imgt[cp]+y, 0), PAL_MAX)
markupdated(cp, true)
change_val(y)
end
function setback(pos, highlight)
@ -196,19 +202,13 @@ function love.update(dt)
end
local function decr()
saved = nil
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
imgt[i] = math.max(imgt[i] - amt, 0)
markupdated(i, true)
end
local amt = -(kt['lshift'] and 16 or 1)
change_val(amt)
end
local function incr()
saved = nil
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
imgt[i] = math.min(imgt[i] + amt, PAL_MAX)
markupdated(i, true)
end
change_val(amt)
end
local function light_propagation_up()
if visual_start then