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

Changing size of dropzone element #68

Closed
fiatjaf opened this issue Aug 25, 2014 · 3 comments
Closed

Changing size of dropzone element #68

fiatjaf opened this issue Aug 25, 2014 · 3 comments

Comments

@fiatjaf
Copy link

fiatjaf commented Aug 25, 2014

I have some code that goes like this (this is Coffeescript, please understand):

    interact(document.querySelector 'div#dropzone')
      .dropzone(true)
      .accept('.draggable')
      .on('dragenter', (e) ->
        t = e.target
        if e.target != e.relatedTarget.parentElement.parentElement
          draggieSize = e.relatedTarget.offsetHeight
          t.style.height = "#{t.offsetHeight + draggieSize}px"
      )
      .on('dragleave', (e) ->
        e.target.style.height = ''
      )
      .on('drop', (e) =>
        @props.onDropDoc e
        e.target.style.height = ''
      )

I want to enlarge the dropzone when I arrive dragging some element, so there's more area to drop. But, despite being enlarged when I arrive with the dragged element, when I move the mouse, still dragging the element, from the original dropzone size to the enlarged part of the dropzone, the dropzone shrinks, as if the added height of the element wasn't part of the interactable.

What can I do?

@taye
Copy link
Owner

taye commented Aug 26, 2014

You can change the interact.dynamicDrop setting so that the sizes and positions of the dropzones are recalculated everytime a dragmove happens.

Calling interact.dynamicDrop(true) should make the dropzones work as you expected them to.

@taye taye closed this as completed Sep 3, 2014
@fiatjaf
Copy link
Author

fiatjaf commented Sep 3, 2014

Ah, I forgot to thank you for this!

@taye
Copy link
Owner

taye commented Sep 3, 2014

Hehe. You're welcome! :D

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

No branches or pull requests

2 participants