From 145e2fee242ea624e66a5175d4582ab6c31c141f Mon Sep 17 00:00:00 2001 From: juongithub Date: Fri, 30 Dec 2016 18:02:16 +0100 Subject: [PATCH 1/2] Update sortable.js --- ui/widgets/sortable.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/ui/widgets/sortable.js b/ui/widgets/sortable.js index fcb33ace145..ea01bef8e4e 100644 --- a/ui/widgets/sortable.js +++ b/ui/widgets/sortable.js @@ -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 void 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, @@ -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() } ); From 45edc9318b7dfa0a0636e4702a2607bb31d1eb87 Mon Sep 17 00:00:00 2001 From: juongithub Date: Fri, 30 Dec 2016 18:04:09 +0100 Subject: [PATCH 2/2] Update sortable.js --- ui/widgets/sortable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/widgets/sortable.js b/ui/widgets/sortable.js index ea01bef8e4e..35740815632 100644 --- a/ui/widgets/sortable.js +++ b/ui/widgets/sortable.js @@ -225,7 +225,7 @@ return $.widget( "ui.sortable", $.ui.mouse, { this.helper.css( "position", "absolute" ); //both _getRelativeOffset() and _getParentOffset() depend on cssPosition, so it should be set - //before calling these functions to void strange positioning on the first sorting action + //before calling these functions to avoid strange positioning on the first sorting action this.cssPosition = this.helper.css( "position" ); $.extend( this.offset, {