added filedropped handler

This commit is contained in:
qeffects 2021-11-06 19:35:42 +02:00
parent 46a9ae4b2f
commit 186d06f887

View File

@ -59,6 +59,11 @@ love.handlers['mousemoved'] = function(x, y, dx, dy, e, f)
orig.mousemoved(x, y, dx, dy, e, f) orig.mousemoved(x, y, dx, dy, e, f)
end end
end end
love.handlers['filedropped'] = function(file, y, dx, dy, e, f)
if not input.eventHandlers.filedropped(file, y, dx, dy, e, f) then
orig.filedropped(file, y, dx, dy, e, f)
end
end
local function sortFunc(t1, t2) local function sortFunc(t1, t2)
if t1 == t2 then if t1 == t2 then
@ -315,6 +320,21 @@ function input.eventHandlers.keypressed(btn, btncode)
return captured return captured
end end
function input.eventHandlers.filedropped(file)
local captured = false
if input.subscriptions.filedropped then
for index, sub in ipairs(input.subscriptions.filedropped) do
if sub.active and sub.stack.element.settings.active then
sub:emit(file)
captured = true
end
end
end
return captured
end
function input.eventHandlers.keyreleased(btn, btncode) function input.eventHandlers.keyreleased(btn, btncode)
local captured = false local captured = false
if input.subscriptions.keyreleased then if input.subscriptions.keyreleased then