From 5f195694ee59df956432d58b56297acd0ac2bc39 Mon Sep 17 00:00:00 2001 From: wasp77 Date: Sat, 8 Aug 2020 21:50:16 -0400 Subject: [PATCH] update simplifier distance to reflect zoom (#2004) * update simplifier distance to reflect zoom The distance used in the iterative end-point fit algorithm to determine if points can be removed no longer ignores the zoom. As the zoom gets larger this distance will get smaller and fewer points will be removed, thus making for finer grain control over the drawing. As the zoom gets smaller the drawing will get more coarse as more points are removed. * remove the comment Co-authored-by: John Dupuis Co-authored-by: Michal Srb --- src/components/App.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/App.tsx b/src/components/App.tsx index 5f77426a..a07adcbe 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -2892,7 +2892,10 @@ class App extends React.Component { } else if (points.length > 1) { if (draggingElement.type === "draw") { mutateElement(draggingElement, { - points: simplify([...(points as Point[]), [dx, dy]], 0.7), + points: simplify( + [...(points as Point[]), [dx, dy]], + 0.7 / this.state.zoom, + ), }); } else { mutateElement(draggingElement, {