1
0
mirror of https://github.com/LDDestroier/CC/ synced 2024-11-10 20:09:59 +00:00

Fixed crash when pushing key on color picker

I can't believe it took Noodle for me to notice this issue
This commit is contained in:
LDDestroier 2019-10-18 02:51:39 -04:00 committed by GitHub
parent f7d040e6aa
commit a5e0d08f72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3057,6 +3057,7 @@ local getInput = function() --gotta catch them all
miceDown[button] = true miceDown[button] = true
if y <= scr_y-(plc.renderBlittle and 0 or doRenderBar) then if y <= scr_y-(plc.renderBlittle and 0 or doRenderBar) then
if (button == 3) then if (button == 3) then
renderBottomBar("Type text onto canvas:")
putDownText(x,y) putDownText(x,y)
miceDown = {} miceDown = {}
keysDown = {} keysDown = {}
@ -3310,6 +3311,7 @@ local getInput = function() --gotta catch them all
x = 2*x x = 2*x
y = 3*y y = 3*y
end end
renderBottomBar("Type text onto canvas:")
putDownText(x,y) putDownText(x,y)
miceDown = {} miceDown = {}
keysDown = {} keysDown = {}
@ -3342,31 +3344,36 @@ local getInput = function() --gotta catch them all
renderBottomBar("Pick color with cursor:") renderBottomBar("Pick color with cursor:")
paintEncoded = clearAllRedundant(paintEncoded) paintEncoded = clearAllRedundant(paintEncoded)
local mevt local mevt
repeat local keepPicking = true
while keepPicking do
mevt = {os.pullEvent()} mevt = {os.pullEvent()}
until (mevt[1] == "key" and mevt[2] == keys.x) or (mevt[2] == 1 and (mevt[4] or math.huge) <= scr_y) if mevt[1] == "mouse_click" then
if not (mevt[1] == "key" and mevt[2] == keys.x) then keepPicking = false
local x, y = mevt[3]+paint.scrollX, mevt[4]+paint.scrollY resetInputState()
if plc.renderBlittle then if mevt[4] < scr_y then
x = 2*x local x, y = mevt[3]+paint.scrollX, mevt[4]+paint.scrollY
y = 3*y if plc.renderBlittle then
end x = 2*x
local p y = 3*y
for a = 1, #paintEncoded[frame] do end
p = paintEncoded[frame][a] local p
if (p.x == x) and (p.y == y) then for a = 1, #paintEncoded[frame] do
paint.t = p.t or paint.t p = paintEncoded[frame][a]
paint.b = p.b or paint.b if (p.x == x) and (p.y == y) then
paint.c = p.c or paint.c paint.t = p.t or paint.t
paint.m = p.m or paint.m paint.b = p.b or paint.b
miceDown = {} paint.c = p.c or paint.c
keysDown = {} paint.m = p.m or paint.m
doRender = true break
isDragging = false end
break end
end
elseif mevt[1] == "key" then
if mevt[2] == keys.x or evt[2] == keys.q then
keepPicking = false
end end
end end
resetInputState()
end end
doRender = true doRender = true
isDragging = false isDragging = false