deepEqual( element.offset(), { top: newY, left: newX }, "doesn't snap on the inner snapTolerance area when snapMode is outer" );
});
+test( "#8165: Snapping large rectangles to small rectangles doesn't snap properly", function() {
+ expect( 1 );
+
+ var snapTolerance = 20,
+ y = 1,
+ element = $( "#draggable1" )
+ .css({
+ width: "50px",
+ height: "200px"
+ }).offset({
+ top: y,
+ left: 1
+ }),
+ element2 = $( "#draggable2" )
+ .css({
+ width: "50px",
+ height: "50px"
+ }).offset({
+ top: y + snapTolerance + 1,
+ left: 200
+ }),
+ newX = element2.offset().left - element.outerWidth() - snapTolerance + 1;
+
+ $( "#draggable1, #draggable2" ).draggable({
+ snap: true,
+ snapTolerance: snapTolerance
+ });
+
+ element.simulate( "drag", {
+ handle: "corner",
+ x: newX,
+ moves: 1
+ });
+
+ notDeepEqual( element.offset(), { top: y, left: newX }, "snaps even if only a side (not a corner) is inside the snapTolerance" );
+});
+
test( "stack", function() {
expect( 2 );
t = inst.snapElements[i].top;
b = t + inst.snapElements[i].height;
- //Yes, I know, this is insane ;)
- if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {
+ if(x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d) {
if(inst.snapElements[i].snapping) {
(inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
}