Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
FreeDraw.onMouseUp = function (state, e){
if (state.dragMoving) {
var tolerance = (3 / ((this.map.getZoom()-4) * 150)) - 0.001 // https://www.desmos.com/calculator/b3zi8jqskw
simplify(state.polygon, {
mutate: true,
tolerance: tolerance,
highQuality: true
});
this.fireUpdate();
this.changeMode(Constants.modes.SIMPLE_SELECT, { featureIds: [state.polygon.id] });
}
}
CircleMode.clickAnywhere = function(state, e) {
if (state.currentVertexPosition === 0) {
state.currentVertexPosition++;
const center = [e.lngLat.lng, e.lngLat.lat];
const circleFeature = circle(center, state.initialRadiusInKm);
state.polygon.incomingCoords(circleFeature.geometry.coordinates);
state.polygon.properties.center = center;
state.polygon.properties.radiusInKm = state.initialRadiusInKm;
}
return this.changeMode(Constants.modes.SIMPLE_SELECT, { featureIds: [state.polygon.id] });
};