Skip to content
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

Figure out the API for nested drop targets #87

Closed
gaearon opened this issue Feb 18, 2015 · 11 comments
Closed

Figure out the API for nested drop targets #87

gaearon opened this issue Feb 18, 2015 · 11 comments
Milestone

Comments

@gaearon
Copy link
Member

gaearon commented Feb 18, 2015

We want to support nested drop target, but make it easy for parent targets to opt out of events when children are active. We have several requirements:

  • No use of e argument for e.stopPropagation and the likes. Ideally, we'll deprecate e and stop passing it in 1.0.
  • Children shouldn't decide whether parents get the events. There may be cases when parent cares about over (e.g. to scroll the view) even if it doesn't handle drag. For this reason, each drop target should be able to decide on its own whether it wants to react to drop and whether it needs to hover.

We already note nesting in acceptDrop: if isHandled is true, this means some child has already handled drop before us (and parent may decide not to do anything in this case). We need a similar API for enter/over/leave as well as their this.getDropState(type).isHovering counterpart.
#85 starts this work by adding a nested dustbin example. We want to find a good API to make it work.

There's an attempt at adding API for this in #76 but it's currently too noisy. @itrelease, can you please write down the API you're proposing there? Or else you can reimplement it on top of #85 so we can see where you're heading.

This issue supersedes #75.

@gaearon gaearon added this to the 0.9 milestone Feb 18, 2015
@gaearon
Copy link
Member Author

gaearon commented Feb 18, 2015

I assign this to 0.9 milestone because I think this can be done in backward-compatible way.

This was referenced Feb 18, 2015
@itrelease
Copy link
Contributor

@nelix
Copy link
Collaborator

nelix commented Feb 25, 2015

#90 is a nested example that seems to work without any use of the event... Not sure if their are other use cases... I will do some testing on my kanban branch.
The kanban branch really does need resurfacing support.

@gaearon
Copy link
Member Author

gaearon commented Mar 9, 2015

I think we figured it out in dnd-core, so I'm closing this one.
We're figuring out how to transition to dnd-core in #111.

To sum up:

  • for dropping, we call drop on each drop target bottom up, each parent can override child's drop result
  • for hovering, there is new isOver(handle, shallow) API that tells if we're hovering over target (just target with shallow=true)

@gaearon gaearon closed this as completed Mar 9, 2015
@deser
Copy link

deser commented Mar 18, 2015

Sorry guys.
Is 'isHandled' in 'over' working in 0.9.8? Will it work in future if it is not working now?
Thanks a lot!

@gaearon
Copy link
Member Author

gaearon commented Mar 18, 2015

@deser Currently we don't expose a way to know from over if you're hovering over the current or a nested target. We will expose an API for that in 0.10 (the next version).

@gaearon
Copy link
Member Author

gaearon commented Mar 18, 2015

@deser We do however expose isHandled in acceptDrop in 0.9.8. This will also be supported in 0.10 (although the API will change).

@deser
Copy link

deser commented Mar 20, 2015

Thanks a lot!

@gaearon gaearon modified the milestones: v1.0, 0.11 Apr 20, 2015
kkga pushed a commit that referenced this issue Apr 21, 2015
Added bottom shadow to the table if there is possibility to scroll down.
@gaearon
Copy link
Member Author

gaearon commented May 19, 2015

@deser This is now exposed in 1.0. You can compare monitor.isOver() with monitor.isOver({ shallow: true }) to learn if it's over the nested target or just the current one.

@deser
Copy link

deser commented May 19, 2015

Great job! Thanks a lot!))

@AndAShape
Copy link

Is there an example of this? What does comparing monitor.isOver() with monitor.isOver({ shallow: true }) mean?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants