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

Default vertical and horizontal drop handlers handle the middle drop differently than Vaadin DD default behavior #55

Open
mjungwir opened this issue Apr 4, 2016 · 0 comments

Comments

@mjungwir
Copy link

mjungwir commented Apr 4, 2016

@johndevs

I wanted to create this and make sure you didn't do it this way on purpose before I did the work to change this. I know exactly what has to change so I can work on it if you would like it changed.

See either vertical or horizontal examples to see what I mean. If you drag an item up in the vertical layout and drop it on the middle of another item it drops below the item. If you drag an item down and drop it on the middle of another item it also ends up below the item. Horizontal has a similar behvior.

However, Vaadin's core default drop will always place the item going the direction it was dragged from when dropping on the middle.

This could have been a conscious decision. If I want it to be different, I can provide my own override, but if you intended it to be the same I can help you out and make a pull request.

Here's the code that would need to change from the drop handler.

// Increase index if component is dropped after or above a previous
// component
VerticalDropLocation loc = details.getDropLocation();
if (loc == VerticalDropLocation.MIDDLE || loc == VerticalDropLocation.BOTTOM) {
idx++;
}

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

1 participant