aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorCourthead <courtlandallen@gmail.com>2012-04-21 18:33:49 -0700
committerScott González <scott.gonzalez@gmail.com>2012-05-22 08:00:20 -0400
commitc42bdcecf825e295f483413f8d20b2079947faec (patch)
tree7c4c7b81da0793d8aadd314f161cf5cb94b59440 /ui
parent033f83ffebf2c25284796d661c01613936674a47 (diff)
downloadjquery-ui-c42bdcecf825e295f483413f8d20b2079947faec.tar.gz
jquery-ui-c42bdcecf825e295f483413f8d20b2079947faec.zip
Sortable: calculating item positions on the fly and setting the direction variable when inserting an item into a different sortable. Fixed #8268 - Items may not be inserted into the correct position when dragged between connected sortables
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.sortable.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js
index 55a64590b..88c8aa374 100644
--- a/ui/jquery.ui.sortable.js
+++ b/ui/jquery.ui.sortable.js
@@ -731,9 +731,10 @@ $.widget("ui.sortable", $.ui.mouse, {
var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top'];
for (var j = this.items.length - 1; j >= 0; j--) {
if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue;
- var cur = this.items[j][this.containers[innermostIndex].floating ? 'left' : 'top'];
+ var cur = this.containers[innermostIndex].floating ? this.items[j].item.offset().left : this.items[j].item.offset().top;
if(Math.abs(cur - base) < dist) {
dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
+ this.direction = (cur - base > 0) ? 'down' : 'up';
}
}
* This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ // -=- WMWindowCopyRect.h // // Helper class which produces copyRect actions by monitoring the location // of the current foreground window. // Whenever processEvent is called, the foreground window's position is // recalculated and a copy event flushed to the supplied UpdateTracker // if appropriate. #ifndef __RFB_WIN32_WM_WINDOW_COPYRECT_H__ #define __RFB_WIN32_WM_WINDOW_COPYRECT_H__ #include <rfb/UpdateTracker.h> namespace rfb { namespace win32 { class WMCopyRect { public: WMCopyRect(); bool processEvent(); bool setUpdateTracker(UpdateTracker* ut); protected: UpdateTracker* ut; void* fg_window; Rect fg_window_rect; }; }; }; #endif // __RFB_WIN32_WM_WINDOW_COPYRECT_H__