-
Notifications
You must be signed in to change notification settings - Fork 145
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
Feature Request: Option to Swap Only Initial and Final Positions #7
Comments
@Danivalldo Thank you! I'm really glad to hear you found it helpful. The library should behave as described in your "Desired Behavior" by only swapping the two elements without affecting others. However, if the cursor hovers over other elements while dragging, it will also swap them, which results in the "Current Behavior." Could you please test and confirm if that's the case? Thanks! |
Hello, Thank you for the quick response and the clarification. I tested the library again as per your instructions. Here are my observations: Test Setup: Initial setup: [A, B, C, D, E] Steps Taken: Results: When dragging directly to 'D', the library swaps only 'A' and 'D' as expected: [D, B, C, A, E]. Feedback: Please let me know if there's anything specific you would like me to test further or if additional details are needed. Thank you for your support and the great work on this library! |
@Danivalldo Thank you for testing! Two solutions come to mind:
I think both options could be useful in different scenarios. I'll need to do some testing to ensure they provide a good user experience. I'll let you know when something is ready! Thanks! |
Thank you for considering these solutions! Both ideas sound great and could be very useful. I appreciate your efforts to improve the library. Looking forward to testing the updates when they are ready! |
@Danivalldo I've added a new config option in createSwapy(container, { continuousMode: false }) Let me know if you have any questions! |
Hello, Thank you for the update! I’ve tested the continuousMode option, and it works perfectly in my project. I appreciate your quick implementation of this feature. Best regards, |
@Danivalldo Really glad to hear that! Thanks! |
Hello,
Firstly, I'd like to thank you for developing and maintaining this fantastic library. It has significantly simplified the implementation of drag-to-swap functionality in my projects.
Issue:
Currently, the library moves every element between the initial and final positions when an element is dragged and dropped. However, in my use case, I need an option to swap only the initial and final positions, without affecting the intermediate elements. This feature would provide greater flexibility and control over the layout behavior during drag-and-drop operations.
Example:
Here's an illustration of the current behavior and the desired behavior:
Current Behavior:
Initial: [A, B, C, D, E]
Drag 'A' to position of 'D'
Result: [B, C, D, A, E]
Desired Behavior:
Initial: [A, B, C, D, E]
Drag 'A' to position of 'D'
Result: [D, B, C, A, E]
Proposal:
I propose adding an option or method to enable swapping only the initial and final positions of the dragged element. This could be a configuration setting or a specific method call.
Benefits:
Enhanced flexibility for different use cases.
Greater control over the layout behavior during drag-and-drop.
More intuitive behavior for certain user interfaces.
Additional Context:
If needed, I can assist with testing the new feature or providing further examples of how this functionality could be utilized.
Thank you for considering this feature request. I look forward to your response and am hopeful that this can be incorporated into the library.
Best regards,
Danivalldo
The text was updated successfully, but these errors were encountered: