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] });
}
}
action: () => {
const { setGeojson, geojson } = this.props;
setGeojson(simplify(geojson));
}
},
return;
}
const points: Point[] = [];
const coords: number[][] = [];
for (const itItem of alt.itinerary) {
for (const point of itItem.shapePoints) {
coords.push(point);
}
}
let id = 0;
for (const p of simplify(lineString(coords), {
mutate: true,
tolerance: 0.0005,
}).geometry.coordinates) {
points.push({
lat: p[0],
lon: p[1],
id,
});
id++;
}
draft.distanceMeasurement.lines.push({
type: 'distance',
points,
});
onChangeLocal = (data: ?Array) => {
if (data) {
this.draw.deleteAll();
const simplified_bounds = simplify(data.value, { tolerance: 0.1 });
this.updateMap(simplified_bounds);
}
};
handleQueryTypeChange = value => {