generated from solidjs-community/solid-lib-starter
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve vertical sort algorithm to better handle arbitrary gaps.
The CSS gap directive on flex layouts does not use margins for example. As a result, the previous implementation would fail to correctly position the sorted elements as it didn't properly account for the gap size. Instead, explicitly calculate the gap from the layout data when sorting. The algorithm is approximately: If the current item is the active draggable If it was moved over a droppable that is later in the vertical list Move it down by the delta between its bottom edge and the droppable bottom edge. Else it was moved earlier in the vertical list so Move it up by the delta between its top edge and the droppable top edge. Else If the draggable was moved above the current item (shifting it down) Move it down by the delta of the draggable height plus any gap that was between the draggable and the item previously before it. Else the current item is being shifted up so Move it up by the delta of the draggable height plus any gap that was between the draggable and the item previously after it. Related to this, remove the now redundant recording of `outerHeight` and `outerWidth` in `elementLayout()`.
- Loading branch information
1 parent
af598b4
commit ad4504d
Showing
3 changed files
with
29 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters