mousetrap icon indicating copy to clipboard operation
mousetrap copied to clipboard

added mouseup action

Open sclausen opened this issue 8 years ago • 5 comments

I implemented

  • leftclick
  • middleclick
  • rightclick

Now it's possible to watch for clicks.

Mousetrap.bind('ctrl+leftclick', function() {
    console.log('ctrl was pressed while left click');
});

Currently I have no idea how to implement tests for this, because I don't know how to fire MouseEvents and KeyboardEvent together.

sclausen avatar Sep 17 '15 15:09 sclausen

+1 Would love to see mouse support added, mousewheel support would be a nice addition to this as well.

A package to simplify the management of hotkeys cannot be complete without this. Many applications have default clicking/scrolling actions and when key modifiers are pressed, they might do something else. For instance, in a painting application, scrolling could change the brush size or zoom level depending on if a key is pressed.

Worth noting however, that while this PR works well with modifiers like ctrl, shift, alt - it doesn't appear to work properly with other keys. For instance a+leftclick will fire on every LMB mouseup event, it doesn't seem to check that the a key is pressed. Also, you're listening to mouseup but calling it a 'click', which is technically incorrect. There should be down, move, up, and click event handling if it were to be implemented properly.

devonzara avatar Oct 26 '15 05:10 devonzara

(+1)

SrMouraSilva avatar Dec 22 '15 00:12 SrMouraSilva

(+1)

pixelpax avatar Jan 18 '16 23:01 pixelpax

Any updates on this?

neurosnap avatar May 31 '16 18:05 neurosnap

+1

JipBoesenkool avatar Feb 11 '19 11:02 JipBoesenkool