Right-click support
Closed this issue · 2 comments
hryx commented
For the life of me, I can't figure out how to add support for RMB clicks which are differentiated from LMB. I want to be able to have context menus and alternative actions on RMB, but all my attempts have just fudged up the mouse module.
vrld, hewp me pwetty pwease?
vrld commented
Immediate mode GUI is not very good with this sort of thing, but this hack^Wfix should work out ok. To detect right or middle clicks, you can use something like this:
local b = gui.Button{text = 'Press me!'}
if b == 'r' then
contextmenu = {love.mouse.getPosition()}
elseif b ~= false then
-- left/middle mouse button or 'return'
end
Note that this fix changes behavior: Before right and middle clicks on Buttons and Inputs were silently ignored, now they can trigger the action.
hryx commented
This is great and is working just fine. Thanks a bunch for the quick hac--uh, fix!