Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow consumers to determine when to perform layout animations and when to measure nodes #144

Merged
merged 12 commits into from
Mar 24, 2021

Conversation

clauderic
Copy link
Owner

@clauderic clauderic commented Mar 21, 2021

This PR allows consumers to customize or override the internal heuristics for determining whether derived transformations should be applied to allow a sortable node to perform layout animations.

By default, layout animations via derived transforms happen when sorting is cancelled or when new elements are added / removed within the list during sorting.

Letting consumers override this option opens up a lot of new possibilities for consumers, such as easily animating adding / deleting items (see #108) or only animating items to their new positions on drop rather than while dragging:

Kapture.2021-03-21.at.19.31.04.mp4
Kapture.2021-03-22.at.10.31.28.mp4
Kapture.2021-03-23.at.21.56.00.mp4

@changeset-bot
Copy link

changeset-bot bot commented Mar 21, 2021

🦋 Changeset detected

Latest commit: fddb961

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@dnd-kit/core Minor
@dnd-kit/sortable Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Mar 21, 2021

Size Change: +1.8 kB (+2%)

Total Size: 82.7 kB

Filename Size Change
packages/core/dist/core.cjs.development.js 24.8 kB +401 B (+2%)
packages/core/dist/core.cjs.production.min.js 12.8 kB +291 B (+2%)
packages/core/dist/core.esm.js 24.6 kB +433 B (+2%)
packages/sortable/dist/sortable.cjs.development.js 4.23 kB +264 B (+7%) 🔍
packages/sortable/dist/sortable.cjs.production.min.js 2.68 kB +152 B (+6%) 🔍
packages/sortable/dist/sortable.esm.js 4.11 kB +256 B (+7%) 🔍
ℹ️ View Unchanged
Filename Size Change
packages/accessibility/dist/accessibility.cjs.development.js 979 B 0 B
packages/accessibility/dist/accessibility.cjs.production.min.js 637 B 0 B
packages/accessibility/dist/accessibility.esm.js 847 B 0 B
packages/accessibility/dist/index.js 148 B 0 B
packages/core/dist/index.js 141 B 0 B
packages/modifiers/dist/index.js 144 B 0 B
packages/modifiers/dist/modifiers.cjs.development.js 838 B 0 B
packages/modifiers/dist/modifiers.cjs.production.min.js 574 B 0 B
packages/modifiers/dist/modifiers.esm.js 766 B 0 B
packages/sortable/dist/index.js 144 B 0 B
packages/utilities/dist/index.js 144 B 0 B
packages/utilities/dist/utilities.cjs.development.js 1.63 kB 0 B
packages/utilities/dist/utilities.cjs.production.min.js 962 B 0 B
packages/utilities/dist/utilities.esm.js 1.55 kB 0 B

compressed-size-action

@clauderic clauderic changed the title Allow consumers to determine when to perform layout animations Allow consumers to determine when to perform layout animations and when to measure nodes Mar 22, 2021
@clauderic clauderic force-pushed the should-perform-layout-animation branch 2 times, most recently from f4f42c4 to 243dd58 Compare March 23, 2021 02:42
@clauderic clauderic force-pushed the should-perform-layout-animation branch from 243dd58 to 432b704 Compare March 23, 2021 02:44
Clauderic Demers and others added 3 commits March 23, 2021 10:36
This strategy allows consumers to measure nodes before dragging instead of right after dragging has begun.
@clauderic clauderic force-pushed the should-perform-layout-animation branch from 2667289 to b7c2780 Compare March 23, 2021 18:05
@clauderic clauderic force-pushed the should-perform-layout-animation branch from a62c749 to fddb961 Compare March 24, 2021 02:01
@clauderic clauderic merged commit 79f6088 into master Mar 24, 2021
@clauderic clauderic deleted the should-perform-layout-animation branch March 24, 2021 02:08
@github-actions github-actions bot mentioned this pull request Mar 24, 2021
@GNUGradyn
Copy link

Can this be added to the docs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants