Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add modifier flags for mouse events #217

Merged

Conversation

DanielGibbsNZ
Copy link
Contributor

This adds modifier flags for mouse events (fixes #216), allowing you to do things like this (which would be useful for when I lose my mouse cursor):

// If I Cmd+Alt+Click, centre my mouse cursor on the main screen.
var handler = new Event('mouseDidLeftClick', function (event) {
    if (_.includes(event.modifiers, 'cmd') && _.includes(event.modifiers, 'alt')) {
        var mainScreen = Screen.all()[0];
        var mainScreenFrame = mainScreen.frame();
        var middle = { 
            x: mainScreenFrame.x + mainScreenFrame.width / 2,
            y: mainScreenFrame.y + mainScreenFrame.height / 2,
        };
        Mouse.move(middle);
    }
});
  • Updated related documentations
  • Added the change to the Changelog

@kasper
Copy link
Owner

kasper commented Jun 8, 2018

Thanks! I will review this with more thought later.

@izanagi1995
Copy link

Bump, LGTM

@DanielGibbsNZ
Copy link
Contributor Author

Any chance of this getting merged soon?

@kasper kasper self-assigned this Dec 27, 2018
@kasper kasper added this to the 2.6.3 milestone Dec 27, 2018
@kasper kasper merged commit 5c2e57d into kasper:master Dec 27, 2018
kasper added a commit that referenced this pull request Dec 27, 2018
@kasper
Copy link
Owner

kasper commented Dec 27, 2018

@DanielGibbsNZ Thanks for the contribution and sorry for the long wait! Merged and this feature is now in build 76.

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

Successfully merging this pull request may close these issues.

Include modifiers in mouse click events
3 participants