Skip to content

added mouseup action#298

Open
sclausen wants to merge 3 commits intoccampbell:masterfrom
sclausen:master
Open

added mouseup action#298
sclausen wants to merge 3 commits intoccampbell:masterfrom
sclausen:master

Conversation

@sclausen
Copy link
Copy Markdown

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.

@devonzara
Copy link
Copy Markdown

+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.

@SrMouraSilva
Copy link
Copy Markdown

(+1)

1 similar comment
@pixelpax
Copy link
Copy Markdown

(+1)

@neurosnap
Copy link
Copy Markdown

Any updates on this?

@JipBoesenkool
Copy link
Copy Markdown

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants