Comments (1)
I tried adding the following tap debounce code to draw_line_string.js
and it seems to have completely solved the problem:
DrawLineString.lastTapTime = Date.now();
DrawLineString.onTap = function (state, e) {
const now = Date.now();
const tapDebounceTimeMS = 300;
if (now - this.lastTapTime < tapDebounceTimeMS) {
return;
}
this.lastTapTime = now;
if (CommonSelectors.isVertex(e)) return this.clickOnVertex(state, e);
this.clickAnywhere(state, e);
};
To get tests to run, I had to add a 400mS delay immediately before every instance of touchTap(...)
in draw_line_string.test.js
. I'm sure my naive sleep()
below isn't the best solution, but I don't really understand how to best implement such a delay within the testing framework:
const tapDebounceDelayMS = 400;
function sleep(milliseconds) {
const date = Date.now();
let currentDate = null;
do {
currentDate = Date.now();
} while (currentDate - date < milliseconds);
}
Used like:
sleep(tapDebounceDelayMS);
touchTap(map, makeTouchEvent(100, 200));
Although I didn't try it, all of the Polygon code should have the same treatment.
from mapbox-gl-draw.
Related Issues (20)
- map.setStyle() followed by mouse event sometimes causes layer not found error HOT 2
- How to get layer or layer id after drawing successfully?
- Detect when feature is being dragged instead of after update HOT 3
- how to draw a polygon above a 100% opacity polygon?
- Support custom draw modes for maplibre? HOT 1
- How to add draw on drawed feature? HOT 9
- How do I disable editing mode after polygon is being drawn?
- Is it possible to configure the drawing tool for lasso selection? HOT 1
- add control blocked while unassociated layer tiles are loading HOT 3
- activate point feature when set point to draw tool by draw.add and draw.changeMode
- Option to set controls titles HOT 1
- Can expressions be used within an interpolator?
- activateUIButton("myMode") and deactivate functionality
- Using Mapbox Draw with Mapbox elements HOT 1
- build dist doesn't work as a local node_modules package HOT 1
- Event that returns a list of coordinates while drawing
- coordinates returns in the wrong order from draw.create on polygon mode
- Incorrect Positioning of Intermediate Points When Drawing Polygons
- Can't Edit after Draw Polygon with Terrain
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapbox-gl-draw.