Skip to content

Restore dispatching 'click' on right-click #2105

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/components/dragelement/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ dragElement.init = function init(options) {
element.ontouchstart = onStart;

function onStart(e) {
if(e.buttons && e.buttons === 2) { // right click
return;
}

// make dragging and dragged into properties of gd
// so that others can look at and modify them
gd._dragged = false;
Expand All @@ -90,6 +86,7 @@ dragElement.init = function init(options) {
startX = offset[0];
startY = offset[1];
initialTarget = e.target;
var rightClick = e.buttons && e.buttons === 2;

newMouseDownTime = (new Date()).getTime();
if(newMouseDownTime - gd._mouseDownTime < DBLCLICKDELAY) {
Expand All @@ -104,11 +101,11 @@ dragElement.init = function init(options) {

if(options.prepFn) options.prepFn(e, startX, startY);

if(hasHover) {
if(hasHover && !rightClick) {
dragCover = coverSlip();
dragCover.style.cursor = window.getComputedStyle(element).cursor;
}
else {
else if(!hasHover) {
// document acts as a dragcover for mobile, bc we can't create dragcover dynamically
dragCover = document;
cursor = window.getComputedStyle(document.documentElement).cursor;
Expand Down
2 changes: 1 addition & 1 deletion test/jasmine/tests/dragelement_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ describe('dragElement', function() {
expect(countCoverSlip()).toEqual(0);

mouseEvent('mouseup', this.x, this.y);
expect(mockObj.handleClick).not.toHaveBeenCalled();
expect(mockObj.handleClick).toHaveBeenCalled();
});

it('should fire off click event when down/up without dragging', function() {
Expand Down