Skip to content

Update sortable.js #1

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions ui/widgets/sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,15 @@ return $.widget( "ui.sortable", $.ui.mouse, {
left: this.offset.left - this.margins.left
};

// After we get the helper offset, but before we get the parent offset we can
// change the helper's position to absolute
// TODO: Still need to figure out a way to make relative sorting possible
this.helper.css( "position", "absolute" );

//both _getRelativeOffset() and _getParentOffset() depend on cssPosition, so it should be set
//before calling these functions to avoid strange positioning on the first sorting action
this.cssPosition = this.helper.css( "position" );

$.extend( this.offset, {
click: { //Where the click happened, relative to the element
left: event.pageX - this.offset.left,
Expand All @@ -227,16 +236,8 @@ return $.widget( "ui.sortable", $.ui.mouse, {

// This is a relative to absolute position minus the actual position calculation -
// only used for relative positioned helper
relative: this._getRelativeOffset()
} );

// After we get the helper offset, but before we get the parent offset we can
// change the helper's position to absolute
// TODO: Still need to figure out a way to make relative sorting possible
this.helper.css( "position", "absolute" );
this.cssPosition = this.helper.css( "position" );

$.extend( this.offset, {
relative: this._getRelativeOffset(),

parent: this._getParentOffset()
} );

Expand Down