Comments (13)
Gosh, I didn't even think of looking at how you were rearranging things under the hood. I just assumed you were changing the DOM, not adjusting styling. Makes sense. Thanks.
from solid-dnd.
I would love to see something like this.
from solid-dnd.
@jcuenod what in that link are you interested in for this issue? (I couldn't see anything that animated final transform.)
What I am thinking about here is more like this - note the dragged element doesn't jump to position on drop, but rather moves smoothly to it.
from solid-dnd.
Sorry, I might have got the wrong end of the stick on this issue. I am hoping for animations of the "middle" (transitioning) state when two elements swap places while one is being dragged. I'm less concerned by the "final" transition tbh.
In sortablejs, this is evident in the simple list example but it also happens in the example you linked.
from solid-dnd.
Ah, gotcha.
So you can use css transform transitions today for the swapping effect. The issue you'll see then is that on drop the dropped item will transition oddly, which is what this issue is about.
from solid-dnd.
Update on this - I'm exploring two approaches currently:
A) Defer clearing drag state until after all onDragEnd
handlers have executed. This removes the need to locally cache state for the purpose of determining positioning post drag for animation. But it also creates an oddity in that there is effectively a dragEnding state that some parts care about and others ignore. The entire system also has knowledge of animation embedded throughout as a result which will make it harder for consumers to customise.
B) Treat animation as an entirely separate concern. This approach attempts to do something similar to autoAnimate - it observes the dnd state and runs animations as appropriate. This is likely to be cleanest solution, but I'm still working through some complexity around changing nodes.
from solid-dnd.
After extensive investigation, I'm going to pursue option (b) and have started foundations for that in 0.7.0. Option (a) ended up overcomplicating the code and expectations for consumers too much.
from solid-dnd.
Hi. Any updates on this topic? Could you please suggest how I can add rotation for the object onDragStart?
from solid-dnd.
This issue is about animating final transform - effectively after solid dnd has completed the drop.
For your case of rotation you should be able to add and remove appropriate style to the item using the draggable.isActiveDraggable
property.
from solid-dnd.
wow! Thanks, but seams I mess up a little bit. I’m trying to implement the transform like this
onDragMove(({ draggable, droppable }) => {
draggable.node.style.transform = "rotate(10deg)"
})
but have no result.
from solid-dnd.
I added an example to https://solid-dnd.com/ - see the "Custom transform (rotate on drag)" example for a rough approach @membranobruno
from solid-dnd.
Are there any updates on the on-drop transform issue? I'm willing to hop in if help is needed—this would be great to have. But I'm not sure where to start or where this issue is at.
from solid-dnd.
No updates - my focus has been elsewhere. I've got a bit more free time currently though so might take another run at it.
Happy to have some help :) The approach I want to try next is keeping this animation decoupled from the core. I see the https://github.com/formkit/auto-animate library as a good inspiration.
The main challenges are:
- By the time we get
onDragEnd
the drag is over and the transform clearing. - Have to handle both the overlay and non-overlay cases.
- Sortables logic - especially when moving between containers.
Trying to sprinkle the logic to handle this throughout was brittle and confusing. That's why I want to see what an external 'observe and animate' approach could do.
from solid-dnd.
Related Issues (20)
- Bento Draggable Layout HOT 2
- attach is used before it is defined HOT 1
- Non deterministic order of events onDragStart, onDragOver, onDragMove
- solid-dnd.com is down! HOT 2
- Get `useDragDropContext is not a function or its return value is not iterable` HOT 1
- TypeError: useDragDropContext is not a function or its return value is not iterable at createDroppable HOT 8
- Allowing access to mouse position on drag & drop context's events HOT 3
- how to rotate a SortableProvider / useSortableContext returns null HOT 1
- Document "touch-none" css for draggables or set it automatically HOT 1
- createDraggable and createDroppable are not reactive HOT 2
- Conditionally Prevent Drag HOT 1
- Draggable SVG shape moves faster than pointer HOT 4
- Unable to load data dynamically. Please help HOT 2
- Recompute layouts on remove
- Access state and actions from callback handlers
- Get current droppable on onDragMove HOT 1
- Only the text is visible on the dragged element HOT 1
- Add support for sortables of irregular sizes. HOT 4
- Beginners Documentation HOT 10
- Trying to render a custom component as sortable HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from solid-dnd.