-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Check if not a left-click, then bail out of onStart #2087
Check if not a left-click, then bail out of onStart #2087
Conversation
3eed451
to
0a4bb0d
Compare
0a4bb0d
to
7e6e899
Compare
var options = { element: this.element, gd: this.gd }; | ||
dragElement.init(options); | ||
|
||
options.element.onmousedown({button: 2}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, that it's a best way to emulate right click, however I can't see any other options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like in mouse_event we have buttons
but if we add button
the same way it should allow right-click simulation?
… disable-drag-on-rightclick # Conflicts: # src/components/dragelement/index.js # test/jasmine/tests/dragelement_test.js
I wasn't able to find 'Buttons' in ie spec, but it works well in ie9, so I changed everything to 'buttons'. |
dragElement.init(options); | ||
|
||
mouseEvent('mousedown', this.x, this.y, { buttons: 2 }); | ||
expect(countCoverSlip()).toEqual(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Very clear correspondence to the test above. Two last changes I would suggest, then I think this is ready to go:
- 🌴 Can you move
countCoverSlip
out one scope so we don't have to repeat it? - Can you continue through
mouseup
as in the test below, and verify thathandleClick
has not been called? (that one ironically looks annoying to DRY 🌴 so you can just repeat the pieces you need.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, thank you
…at handler won't being called on right click
Fantastic @AlexVvx - thanks for the PR and updates! 💃 - we're calling this a bug fix, so it can go in the release we're planning later today. |
Related to #248
This PR adds check in dragElement. On start, if not a left-click, then bail out of onStart. The purpose of this check is to let developers to use their own context menu instead of browser context menu. Without that check there were no possibility to see 'contextmenu' event when click inside plot container.