Skip to content

Commit

Permalink
fix: resolve error on zoom
Browse files Browse the repository at this point in the history
Fixes: #1370
  • Loading branch information
Sebastien-Ahkrin authored and stropitek committed Feb 8, 2022
1 parent ca8fb76 commit 6285e22
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/component/EventsTrackers/BrushTracker.tsx
Expand Up @@ -121,7 +121,15 @@ export function BrushTracker({

useEffect(() => {
const { step, startX, endX } = state;
if (step === 'end' && Math.abs(startX - endX) > 5) {

if (step === 'end') {
const shouldZoom =
Math.hypot(startX, endX) === Math.sqrt(startX ** 2 + endX ** 2);

if (!shouldZoom) {
return;
}

onBrush(state);
dispatch({
type: 'DONE',
Expand Down

0 comments on commit 6285e22

Please sign in to comment.