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

Is there a way to have a non-draggable element in the dndzone? #334

Closed
Fedeorlandau opened this issue Dec 8, 2021 · 7 comments · May be fixed by #335
Closed

Is there a way to have a non-draggable element in the dndzone? #334

Fedeorlandau opened this issue Dec 8, 2021 · 7 comments · May be fixed by #335

Comments

@Fedeorlandau
Copy link

Fedeorlandau commented Dec 8, 2021

Hello folks, thank you for this amazing library.

I was wondering if there is a way to make a child of dndzone not draggable, check this:

https://svelte.dev/repl/79d20aa7e7264fbbbc9145a3f98a2b87?version=3.22.2

image

The issue is that the <div> enclosing the input and the button is draggable and it's causing a few issues.
Why do I need this? because I'd like to keep the dndzone full height and this "new item" div always at the bottom of the last item.

Regards!

@Fedeorlandau
Copy link
Author

Fedeorlandau commented Dec 8, 2021

Found this unsolved question, #327 which is pretty much what I'm trying to accomplish.

@isaacHagoel
Copy link
Owner

Hi,
First of all thanks for making pull requests!
I am trying to understand the usecase for this.

  1. Why not add the footer element the same way that the header (TODO, DOING etc) is added (outside of the zone)?
  2. Do you ever need/want those disabled items to be in the middle of the list?

For #327 I offered a solution in the last comment but I don't know if the ticket creator gave it a shot.

@Fedeorlandau
Copy link
Author

Fedeorlandau commented Dec 8, 2021

Hi there. I just updated my PR to introduce this non-draggable elements into the drop-zone. I've reverted the disableDrag option on the items because I need to update the keyboardAction file which I forgot lol.

  1. Because if you have an empty column without a min-height it's pretty hard to drop the items there. If you add the min-height to give the drop zone more room then the "Add new item" card has an ugly "margin-top" (which is the min-height of the dropzone). It's basically for giving more room on the dropzone to drop items. This is the example: https://svelte.dev/repl/6a335f2fdf7a4349a6f75ab990f30636?version=3.22.2
Current release My PR
failed working
  1. I've reverted the disabledDrag option on items. It doesn't make sense at this point.

You're welcome!

@isaacHagoel isaacHagoel linked a pull request Dec 9, 2021 that will close this issue
@isaacHagoel
Copy link
Owner

instead of adding an element in order to control the height (is there any other reason we are adding it there?), can we instead add an option to treat the dropzone as if it is bigger?
something like zoneMargins: 0 0 0 100px or whatever (defaults to all zeros).
then in the calculations that determine whether the centre of the dragged element is inside we can simply offset the rect coordinates by the given numbers.
what do you think?

@Fedeorlandau
Copy link
Author

@isaacHagoel that makes totally sense. Adding that element inside the dndzone is more of a hackish solution for the height issue. There is no other reason for it.

I'll explore adding that in a few hours. Feel free to close the PR :)

@isaacHagoel
Copy link
Owner

@Fedeorlandau hi, any updates on this?

@Fedeorlandau
Copy link
Author

Hi @isaacHagoel I couldn't find a way to increase the min-height for it. Sorry.

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

Successfully merging a pull request may close this issue.

2 participants