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

Improvement: contextmenu for x seconds to remove vertex on touch devices #723

Open
henrikmaa opened this issue Dec 9, 2020 · 1 comment

Comments

@henrikmaa
Copy link
Contributor

henrikmaa commented Dec 9, 2020

Using touch devices it is really hard to move vertecies without deleting them. (works fine on chrome tools, need to be tested on actual touch device)

Possible solution: Add an option that allows you to specify how long you need to hold the vertex before it deletes, resets if the vertex is moved.

I have tried to do kind of the same approach leaflet does, using touchstart and touchend to set a timeout. But could not get it to work. (could not get touchstart and touchend event to do anything)

Leaflet currently does this:

 // simulate long hold but setting a timeout 
 this._holdTimeout = setTimeout(Util.bind(function () { 
 	if (this._isTapValid()) { 
 		this._fireClick = false; 
 		this._onUp(); 
 		this._simulateEvent('contextmenu', first); 
 	} 
 }, this), 1000); 

If someone has an idea how to go about this it would be greatly appriciated.

Note: It may be biased towards IOS devices. Tested with iphone and ipad on IOS 13 and 14 with safari and chrome where issue is the same on all of the cases. I dont have an android so I cant test that. Altough I am expecting same issue there.

@henrikmaa
Copy link
Contributor Author

henrikmaa commented Dec 10, 2020

I will refactor preventMarkerRemoval for my own use;
removalMode: false

if removalMode is true, it will do the same as preventMarkerRemoval, with "click" instead of "contextmenu".
If this is wanted in geoman aswell as an option additionally to preventMarkerRemoval Im happy to make a PR.

Can then be controlled on or off in project code with removalMode variable on pm.enable().

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

No branches or pull requests

1 participant