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

Check if not a left-click, then bail out of onStart #2087

Merged
merged 5 commits into from
Oct 16, 2017

Conversation

AlexVvx
Copy link

@AlexVvx AlexVvx commented Oct 13, 2017

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.

@AlexVvx AlexVvx force-pushed the disable-drag-on-rightclick branch from 3eed451 to 0a4bb0d Compare October 13, 2017 21:13
@AlexVvx AlexVvx force-pushed the disable-drag-on-rightclick branch from 0a4bb0d to 7e6e899 Compare October 13, 2017 21:14
var options = { element: this.element, gd: this.gd };
dragElement.init(options);

options.element.onmousedown({button: 2})
Copy link
Author

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.

Copy link
Collaborator

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?

Alex Vinober added 3 commits October 16, 2017 11:25
… disable-drag-on-rightclick

# Conflicts:
#	src/components/dragelement/index.js
#	test/jasmine/tests/dragelement_test.js
@AlexVvx
Copy link
Author

AlexVvx commented Oct 16, 2017

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);
Copy link
Collaborator

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 that handleClick has not been called? (that one ironically looks annoying to DRY 🌴 so you can just repeat the pieces you need.)

Copy link
Author

@AlexVvx AlexVvx Oct 16, 2017

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
@etpinard etpinard added status: reviewable bug something broken labels Oct 16, 2017
@alexcjohnson
Copy link
Collaborator

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.

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

Successfully merging this pull request may close these issues.

3 participants