Skip to content

Commit

Permalink
fix: prevent slowdown caused by invalid targetDepth when using maxDepth
Browse files Browse the repository at this point in the history
Fixes #194
  • Loading branch information
fritz-c committed Nov 28, 2017
1 parent 6908483 commit c21d4de
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/dnd-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ export default class DndManager {
const draggedNode = monitor.getItem().node;
const draggedChildDepth = getDepth(draggedNode);

targetDepth = Math.min(
targetDepth,
this.maxDepth - draggedChildDepth - 1
targetDepth = Math.max(
0,
Math.min(targetDepth, this.maxDepth - draggedChildDepth - 1)
);
}

Expand Down

0 comments on commit c21d4de

Please sign in to comment.