-
-
Notifications
You must be signed in to change notification settings - Fork 637
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
Correct way to pull draggable item from the outside and converting it to a moveable on the fly? #920
Comments
I just found out, that it is not possible to switch the dragging (Ghost) image in the dragenter event for security reasons. So, my proposed idea cannot work. Therefore, let me re-phrase my requirement: Is there a vanillaJS demo for this? Or what would be a good practice? |
Okay, almost there! Dealing with the HTML5 default dragging image is a real pain and I would appreciate it, if moveable would come with a default solution to this! @daybrush I still haven't figured out how to get the element guidelines right (see demo). Currently, only the first element with class ".selectable" is subject to snapping. All other elements (that are dynamically created) with class ".selectable" can only snap to the first element, but to nothing else. |
moveable's new version is released. |
@daybrush Works like a charm! Amazing! For those who are interested, here is the final codepen: |
Environments
Description
I want to have this: On my left panel are items (placeholders) that are draggable in the classic way. When those are pulled into my drag area, the classic drag image will be hidden and at the same location, I create a new html element that is already in the state of dragging, so we have a seamless transition. When the left mouse button is released, that dragged element is finally placed AND the placeholder still resides in the left panel, so he can be placed many times.
My test code:

Problem is: whenever the dragEnter is triggered, the new element is placed and it is selected, but it doesn't move with the mouse. Only when I lift the left mouse button, the element will snap to the mouse cursor and will move with it (even though no button is pressed anymore).
I have the feeling, that my way of approaching this problem is fundamentally wrong. What would be the correct way?
Thanks!
The text was updated successfully, but these errors were encountered: