Forum Discussion
Drag 'n' drop issue
I understand that once a drag item is dropped correctly, it should no longer be draggable. The Correct layer should appear only once for each correctly placed item.
On the other hand, if a drag item is dropped incorrectly, it should remain draggable and allow repositioning to another drop target.
What complicates things is that the Drop Incorrect state tends to persist even when the item is moved from one incorrect target to another — so the Incorrect feedback layer doesn’t always trigger each time it’s dropped incorrectly again.
Moreover, if the item is moved out of any drop target entirely, it still retains the Drop Incorrect state and may trigger the Incorrect layer, even when it's dropped outside of a valid target.
In the attached version, each drag item is set to the Disabled state once it is correctly dropped, so it can no longer be dragged again, while the Correct layer displays as expected.
Once all drag items are in the Disabled state, the "Well Done" layer will appear.
If a drag item is dropped incorrectly, the Incorrect layer will show, and the item will be returned to its starting position (by forcing it back to the Normal state with Motion path), allowing it to be dragged and dropped onto another valid target. This way, the Incorrect layer won't appear redundantly if the item is dropped outside a valid drop target.
Nedim : Your solution is a great improvement on what I had posted (and have since deleted).
I haven't used a drag-and-drop in so long, and I didn't bother testing unlikely-but-still-possible situations, like if the user dropped an object outside of the targets or dragged an object that had already been correctly dropped. My bad. 🤷♀️
JG4 : I will add one note from the previous reply that I deleted: It's great that you only included the drag-and-drop slide in the file you uploaded. I also suggest that you give meaningful names to all objects and layers (and variables, if used). That will help you when programming. And it will make it easier for you and for others to troubleshoot.
You'll see that Nedim took the time to do that in the file he attached.
- Nedim3 months agoCommunity Member
JudyNollet You shouldn’t have deleted your solution. Without it, it would’ve been much harder for me to identify the inconsistent Drop Incorrect state behavior — especially since you clearly defined both Drop Correct and Drop Incorrect states, which wasn’t the case in the original version.
Your version was more elegant, using only a few well-placed triggers to do the job. Since this interaction was mainly driven by the original poster’s requirements, I had no choice but to use additional triggers just to work around the Drop Incorrect state when it was no longer needed.
Custom drag-and-drop interactions are always tricky to fix or adapt. We all use different techniques — some more intuitive than others — and it’s always a challenge to implement custom logic on top of someone else’s structure.
I also suggest that you give meaningful names to all objects and layers (and variables, if used). That will help you when programming. And it will make it easier for you and for others to troubleshoot. Golden advice — this should be pinned to the top of every discussion thread.- JudyNollet3 months agoSuper Hero
Thanks! I thought that your version included what worked in mine—and then made it better. So I figured it'd be simpler for folks to just look at one file. 😊
Related Content
- 9 months ago
- 4 months ago
- 2 years ago