Skip to content

Commit

Permalink
Room swapping now prevents mouse events from going through
Browse files Browse the repository at this point in the history
  • Loading branch information
Cruor committed Feb 27, 2021
1 parent fc0c82a commit 5ca1ec0
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/input_devices/tool_device.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,40 @@ local function tryRoomSwap(x, y, button, istouch, presses)
end
end

-- Make sure we don't send release/click events for room swaps
local consumeNextRelease = false

function device.mousereleased(x, y, button, istouch, presses, click)
if consumeNextRelease then
return true
end

local currentTool = toolHandler.currentTool

if click then
local consume = tryRoomSwap(x, y, button, istouch, presses)

if consume then
consumeNextRelease = true

return true
end
end

if currentTool and currentTool.mousereleased then
currentTool.mousereleased(x, y, button, istouch, presses, click)
end
end

function device.mouseclicked(x, y, button, istouch, presses)
consumeNextRelease = false

local consume = tryRoomSwap(x, y, button, istouch, presses)
local currentTool = toolHandler.currentTool

if consume then
consumeNextRelease = true

return true
end

Expand Down

0 comments on commit 5ca1ec0

Please sign in to comment.