-
Notifications
You must be signed in to change notification settings - Fork 108
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
Finalize callback is called with some delay #572
Comments
Hi Ben, |
very reactive, thank you ! I'll make that |
Here you go : What I understand from this is that finalize is called after the last animation which is of length flipDurationMs Ideally, having both mouse information and DOM element in the callbacks event object would make everything easier and cleaner for this kind of manipulation |
From the libs perspective what happens is the element is dropped outsize of any dndzone and should return to its original spot. One feature that was discussed before (I don't remember why it wasn't merged but can try to dig it up if needed) is the ability to cancel the final animation to place but... |
Thank you for your answer. The other thing that I want to implement that I can't seem to do is being able to "snap" to some position depending on the neighbouring elements (in the absolute canvas), so it makes it easier to align elements. |
I see.
|
yes :) I think in general, adding more information to the callbacks (and more frequent callbacks) would allow users to be more free to create more specific scenarios |
Actually it's not really cancelling the drop animation (though it would be a nice option), but being able to run code before. Let's say I would want to force it to a certain snapped position instead of exactly where I dropped it, then I would want to set its top/left just before the drop animation occurs. It should then just go smoothly to the target position |
Can you define how that would look like? Changing the order/timing of the
events could break other stuff
…On Tue, May 7, 2024, 18:14 Ben Kuper ***@***.***> wrote:
Actually it's not really cancelling the drop animation (though it would be
a nice option), but being able to run code before. Let's say I would want
to force it to a certain snapped position instead of exactly where I
dropped it, then I would want to set its top/left just before the drop
animation occurs. It should then just go smoothly to the target position
—
Reply to this email directly, view it on GitHub
<#572 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE4OZCYPPWYB2TOCWK4NVIDZBCEOPAVCNFSM6AAAAABHI3K47KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJXG4YTEMRZGI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
sorry for the very late answer, I had to switch to other projects and completely forgot about this.. I'm now again on it, this is what it looks like right now : when moving inside a "Free layout" container, the drop is not super nice because it will animate from the last position updated from dnd to the one that i'm calculating manually from the mouse position. If there is a clean way to handle repositionning inside freeform layout I'd be super interested ! Important to note that those element needs to also be dragged and dropped outside this canvas and then be inserted in other types of layout |
Hello, I'm building a flexible UI editor using svelte and this lib is great !
I have different containers with different layout types (horizontal, vertical, grid and "free" which is absolute positionning).
Almost everything works very well, except the free layout : I need to specify the top/left absolute position on drop so that the dragged element goes exactly where it was dropped.
I managed to use consider and finalize callbacks to set the properties of the element, but whatever I use, either the placement or the timing won't be good :
Is there a callback that is called either on each mouse move (including the even detail), or a "drop" callback that is called right after the mouseup (at least before it's animated) ?
I think both implementations would be great, as it seems from the different issues that getting more info on mouse and dragged element when dragging is of interest to many people :)
Thank you !
The text was updated successfully, but these errors were encountered: