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

contextmenu event should dissociate right click event from rotate/tilt event #8824

Open
Dahkon opened this issue Sep 30, 2019 · 9 comments
Open
Labels
bug 🐞 environment-specific 🖥️ needs investigation 🔍 Issues that require further research (e.g. it's not clear whether it's GL JS or something else)

Comments

@Dahkon
Copy link

Dahkon commented Sep 30, 2019

I'm trying to implement a right click (long tap on mobile device) event that add a marker unfortunatly, when we rotate / tilt map with the right click button the marker is added too.

map.on('contextmenu', function(e) {
	console.log(e);
       /* adding marker is not a good idea here */
});

Expected behavior :
right click / long tap : add the marker
right click move (tilt / rotate) : don't add the marker

I think states could be added to the "map mouse event" to indicate if tilt or rotate occures when contextmenu fired or maybe some other events ? (long tap, right click for exemple)

Tests are done on chrome desktop for now.

I'm also open to any workaround. Thanks,

@ansis
Copy link
Contributor

ansis commented Oct 2, 2019

I tried reproducing this by adding the event logging to a page containing just the map (debug/index.html) and I'm not able to reproduce the problem. For me the context event fires only when the map isn't rotated or tilted. I'm trying with Chrome and a trackpad

Can you check that you are on the latest mapbox-gl-js and create a jsfiddle with the exact example that reproduces the issue for you?

Thanks!

@Dahkon
Copy link
Author

Dahkon commented Oct 3, 2019

Here you go, still occurs with v1.4.0 : https://jsfiddle.net/z92tnvdp/

Test drive :
Right click on the map => add a marker
Right click and hold to rotate, tilt => add a marker but shouldn't

I expect the right click to act just like the left click (click or move the map is not the same event).

Thanks,

@kkaefer
Copy link
Contributor

kkaefer commented Dec 3, 2019

I tried this in Firefox and Chrome and couldn't reproduce the behavior you're describing. A regular right click adds the marker, while right-click + pan tilts and rotates the map, but does not add a marker.

@kkaefer kkaefer closed this as completed Dec 3, 2019
@Dahkon
Copy link
Author

Dahkon commented Dec 3, 2019

Did you try on the jsfiddle ?
It's still occuring on Chrome different PC though AND firefox (Windows) with a regular 2 buttons mouse.

The problem is the same on our app or on the jsfiddle.
When you hold right mouse button to tilt / rotate, on mouse up the marker is added BUT shouldn't.

@kkaefer
Copy link
Contributor

kkaefer commented Dec 3, 2019

@Dahkon yes, I used your JSFiddle. What browser versions are you using?

@kkaefer
Copy link
Contributor

kkaefer commented Dec 3, 2019

When you hold right mouse button to tilt / rotate, on mouse up the marker is added BUT shouldn't.

That is the behavior I'm observing. Once the tilt/rotatehandler kicks in, no icon is added.

@Dahkon
Copy link
Author

Dahkon commented Dec 3, 2019

@Dahkon yes, I used your JSFiddle. What browser versions are you using?

Browsers are UP to date but I tried on severals pc (not on mac). Same behavior.

@kkaefer
Copy link
Contributor

kkaefer commented Dec 4, 2019

on severals pc (not on mac)

that was the missing piece. I assume with PC you mean Windows. I just tried your JSFiddle on Windows 10 in Chrome 78, Firefox 70, Edge 44, and IE 11 and could reproduce this behavior both with a trackpad and with an external mouse.

@kkaefer kkaefer reopened this Dec 4, 2019
@Dahkon
Copy link
Author

Dahkon commented Dec 4, 2019

on severals pc (not on mac)

that was the missing piece. I assume with PC you mean Windows. I just tried your JSFiddle on Windows 10 in Chrome 78, Firefox 70, Edge 44, and IE 11 and could reproduce this behavior both with a trackpad and with an external mouse.

Yes Windows 10, 8.1 and 7 (not tested under). Sorry I should have said that earlier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 environment-specific 🖥️ needs investigation 🔍 Issues that require further research (e.g. it's not clear whether it's GL JS or something else)
Projects
None yet
Development

No branches or pull requests

3 participants