craft.js icon indicating copy to clipboard operation
craft.js copied to clipboard

Added events.draggedOver part 2.5

Open ankri opened this issue 4 years ago • 7 comments

Kodak bot went crazy with #184 and automatically merged the PR. Hopefully this won't be auto merged.

This PR adds draggedOver to the events. It's almost the same as #37 but targets the next branch and the new EventHandlers, which also gives us a cleaner API. (#37 will be obsolete).

Since the new EventHandlers introduced a Set as the store for the EventHandlers, we can now store not only the id of the node we are dragging over, but all of its ancestors, too.

I also updated the Basic example with two different examples on how to make use of the new API.

Closes #28 Closes #37 Closes #183


The only complaint we have with the new API is the name draggedOver. @prevwong suggested to re-use the hovered event. If an element is being hovered, and the dragged event stores at least one nodeId, we are dragging over an element. I prefer a more explicit API over an implicit one. As a counter argument Prev suggested to make use of the EventHelpers.

I, too am not a fan of the name draggedOver but lack the creativity to come up with a better name, but I prefer the DX of having an explicit event for dragging over elements. My argument is, that the developer could discover the API with just using code completion and without having to have a look at the documentation of hovered or looking at a guide / example.

Maybe @matdru, @mresposito or @timc1 can chime in and discus the API. Not only these guys, but everyone is welcome to leave a comment. 👍

ankri avatar Feb 12 '21 08:02 ankri

Deploy preview for craftjs ready!

Built with commit 5f29f19a3abef03c759febeb50f6146cd36aa6ce

https://deploy-preview-186--craftjs.netlify.app

netlify[bot] avatar Feb 12 '21 08:02 netlify[bot]

The example

ankri avatar Feb 12 '21 08:02 ankri

@DavraYoung as promised. Thanks again for reminding me, that this still open

ankri avatar May 17 '21 17:05 ankri

Is there any progress?I need it.

linxianxi avatar Sep 13 '21 04:09 linxianxi

We haven't decided on a name, since both @prevwong and I don't really like the name draggedOver

ankri avatar Sep 22 '21 10:09 ankri

Hey @ankri, when might this be included in a release?

michaeled avatar Nov 09 '21 21:11 michaeled

Closing in favor of #374

ankri avatar Feb 09 '22 15:02 ankri

Closing due to no time available

ankri avatar Feb 19 '24 08:02 ankri