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

Reorder list item behaviour is not correct when moving up #1394

Closed
cherreman opened this issue May 15, 2014 · 1 comment
Closed

Reorder list item behaviour is not correct when moving up #1394

cherreman opened this issue May 15, 2014 · 1 comment
Assignees
Milestone

Comments

@cherreman
Copy link

When reordering items in a list, the following behaviour is applied:

  • move down: the item below the dragged item is moved up when the bottom of the dragged item crosses the vertical center of the item below
  • move up: the item above the dragged item is moved down when the bottom of the dragged item crosses the vertical center of the item above

The latter is not correct IMO since it should move the item above when the top of the dragged item crosses the vertical center of the item above.

The following code fixes this behaviour (the topSibling.offsetHeight should also be added in the first if-statement):

if(topSibling && (thisOffsetTop < topSibling.offsetTop + topSibling.offsetHeight + topSibling.offsetHeight/2)) {
    ionic.DomUtil.swapNodes(this._currentDrag.placeholder, topSibling);
    return index - 1;
} else if(bottomSibling && thisOffsetTop > (bottomSibling.offsetTop + bottomSibling.offsetHeight/2)) {
    ionic.DomUtil.swapNodes(bottomSibling, this._currentDrag.placeholder);
    return index + 1;
}
@ionitron-bot
Copy link

ionitron-bot bot commented Sep 6, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants