Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Sortable: update placeholder when axis is x or y for connected lists #941

Closed
wants to merge 4 commits into from

2 participants

@MoonScript

Fixes #8301 - Placeholder doesn't move when using connectWith option.

MoonScript added some commits
@MoonScript MoonScript Sortable: update placeholder when axis is x or y for connected lists.…
… Fixed #8301 - Placeholder doesn't move when using connectWith option
96d5f18
@MoonScript MoonScript Revert "Sortable: update placeholder when axis is x or y for connecte…
…d lists. Fixed #8301 - Placeholder doesn't move when using connectWith option"

This reverts commit 96d5f18.
f213691
@MoonScript MoonScript Merge branch 'master' of https://github.com/jquery/jquery-ui 54ecfde
@MoonScript MoonScript Sortable: update placeholder when axis is x or y for connected lists.…
… Fixed #8301 - Placeholder doesn't move when using connectWith option
6e992f7
@mikesherov
Collaborator

Thanks for contributing, @MoonScript. Could you kindly sign our CLA: http://contribute.jquery.org/CLA/ so I could land this excellent patch?

@MoonScript
@mikesherov
Collaborator
@mikesherov
Collaborator

Thanks @MoonScript! Landed in f306a82.

@mikesherov mikesherov closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 7, 2012
  1. @MoonScript

    Sortable: update placeholder when axis is x or y for connected lists.…

    MoonScript authored
    … Fixed #8301 - Placeholder doesn't move when using connectWith option
Commits on Mar 20, 2013
  1. @MoonScript

    Revert "Sortable: update placeholder when axis is x or y for connecte…

    MoonScript authored
    …d lists. Fixed #8301 - Placeholder doesn't move when using connectWith option"
    
    This reverts commit 96d5f18.
  2. @MoonScript
Commits on Mar 21, 2013
  1. @MoonScript

    Sortable: update placeholder when axis is x or y for connected lists.…

    MoonScript authored
    … Fixed #8301 - Placeholder doesn't move when using connectWith option
This page is out of date. Refresh to see the latest.
View
29 tests/unit/sortable/sortable_options.js
@@ -151,6 +151,35 @@ test( "#8792: issues with floated items in connected lists", function() {
equal( changeCount, 3, "change fired once for each expected change when dragging a floated sortable to a connected container" );
});
+test( "#8301: single axis with connected list", function() {
+ expect( 1 );
+
+ var element = $( "#sortable" ).sortable({
+ axis: "y",
+ tolerance: "pointer",
+ connectWith: ".connected"
+ });
+
+ $( "<ul class='connected'><li>Item 7</li><li>Item 8</li></ul>" )
+ .sortable({
+ axis: "y",
+ tolerance: "pointer",
+ connectWith: "#sortable",
+ receive: function() {
+ ok( true, "connected list received item" );
+ }
+ })
+ .insertAfter(element);
+
+ element.find( "li" ).eq( 0 ).simulate( "drag", {
+ handle: "corner",
+ dx: -1,
+ dy: 114,
+ moves: 1
+ });
+
+});
+
/*
test("{ connectWith: false }, default", function() {
ok(false, "missing test - untested code is broken code.");
View
4 ui/jquery.ui.sortable.js
@@ -535,7 +535,9 @@ $.widget("ui.sortable", $.ui.mouse, {
b = t + item.height,
dyClick = this.offset.click.top,
dxClick = this.offset.click.left,
- isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r;
+ isOverElementHeight = (this.options.axis === "x") || ((y1 + dyClick) > t && (y1 + dyClick) < b),
+ isOverElementWidth = (this.options.axis === "y") || ((x1 + dxClick) > l && (x1 + dxClick) < r),
+ isOverElement = isOverElementHeight && isOverElementWidth;
if ( this.options.tolerance === "pointer" ||
this.options.forcePointerForContainers ||
Something went wrong with that request. Please try again.