Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6c2e78c
Tabs: Fix line length violations
arschmitz Mar 30, 2016
e1fc956
Spinner: Fix line length violations
arschmitz Mar 30, 2016
d6f13d2
Sortable: Fix line length issues
arschmitz Mar 31, 2016
657831e
Slider: Fix line length issues
arschmitz Mar 31, 2016
fd3c6b8
Selectable: Fix line length issues
arschmitz Mar 31, 2016
fd55b4b
Resizable: Fix line length issues
arschmitz Mar 31, 2016
61870bd
Progressbar: Fix line length issues
arschmitz Mar 31, 2016
54cb50e
Mouse: Fix line length issues
arschmitz Mar 31, 2016
27d7717
Menu: Fix line length issues
arschmitz Mar 31, 2016
9b0783a
Droppable: Fix line length issues
arschmitz Mar 31, 2016
5a0da8e
Draggable: Fix line length issues
arschmitz Mar 31, 2016
804f35a
Dialog: Fix line length issues
arschmitz Mar 31, 2016
2b323d8
Controlgroup: Fix line length issues
arschmitz Mar 31, 2016
d038d51
Checkboxradio: Fix line length issues
arschmitz Mar 31, 2016
c62064b
Accordion: Fix line length issues
arschmitz Mar 31, 2016
76b34ae
Widget: Fix line length issues
arschmitz Mar 31, 2016
041721e
Scroll Parent: Fix line length issues
arschmitz Mar 31, 2016
3bfe871
Position: Fix line length issues
arschmitz Mar 31, 2016
ae9c8fd
i18n: Fix line length issues
arschmitz Mar 31, 2016
c60b20c
Effects: Fix line length issues
arschmitz Mar 31, 2016
787b96e
Build: Fix line length issues
arschmitz Mar 31, 2016
11a95d2
Plugin: Fix line length issues
arschmitz Mar 31, 2016
fb344f1
Effect: Fix line length issues
arschmitz Mar 31, 2016
6cb584c
Selectmenu: Disable maxLineLength for description meta
arschmitz Mar 31, 2016
318905f
Progressbar: Disable maxLineLength for description meta
arschmitz Mar 31, 2016
30b8a1c
Datepicker: Disable maxLineLength for jscs
arschmitz Mar 31, 2016
7ac0cd5
Accordion: Disable maxLineLength for description meta
arschmitz Mar 31, 2016
e53864d
Effects: Disable maxLineLength for description meta explode
arschmitz Mar 31, 2016
da4f90d
Effect: Disable maxLineLength for description meta
arschmitz Mar 31, 2016
07acae9
Build: Remove maxLineLength execption in .jscsrc
arschmitz Mar 31, 2016
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
Prev Previous commit
Next Next commit
Droppable: Fix line length issues
  • Loading branch information
arschmitz committed Apr 6, 2016
commit 9b0783adb336ac0074533c0c3254dd15df1ae861
86 changes: 59 additions & 27 deletions ui/widgets/droppable.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,13 @@ $.widget( "ui.droppable", {
var draggable = $.ui.ddmanager.current;

// Bail if draggable and droppable are same element
if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
if ( !draggable || ( draggable.currentItem ||
draggable.element )[ 0 ] === this.element[ 0 ] ) {
return;
}

if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||
draggable.element ) ) ) {
this._addHoverClass();
this._trigger( "over", event, this.ui( draggable ) );
}
Expand All @@ -161,11 +163,13 @@ $.widget( "ui.droppable", {
var draggable = $.ui.ddmanager.current;

// Bail if draggable and droppable are same element
if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
if ( !draggable || ( draggable.currentItem ||
draggable.element )[ 0 ] === this.element[ 0 ] ) {
return;
}

if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||
draggable.element ) ) ) {
this._removeHoverClass();
this._trigger( "out", event, this.ui( draggable ) );
}
Expand All @@ -178,25 +182,39 @@ $.widget( "ui.droppable", {
childrenIntersection = false;

// Bail if draggable and droppable are same element
if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
if ( !draggable || ( draggable.currentItem ||
draggable.element )[ 0 ] === this.element[ 0 ] ) {
return false;
}

this.element.find( ":data(ui-droppable)" ).not( ".ui-draggable-dragging" ).each( function() {
var inst = $( this ).droppable( "instance" );
if (
inst.options.greedy &&
!inst.options.disabled &&
inst.options.scope === draggable.options.scope &&
inst.accept.call( inst.element[ 0 ], ( draggable.currentItem || draggable.element ) ) &&
intersect( draggable, $.extend( inst, { offset: inst.element.offset() } ), inst.options.tolerance, event )
) { childrenIntersection = true; return false; }
} );
this.element
.find( ":data(ui-droppable)" )
.not( ".ui-draggable-dragging" )
.each( function() {
var inst = $( this ).droppable( "instance" );
if (
inst.options.greedy &&
!inst.options.disabled &&
inst.options.scope === draggable.options.scope &&
inst.accept
.call(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd move this up to the previous line, then outdent the next two lines.

inst.element[ 0 ], ( draggable.currentItem || draggable.element )
) &&
intersect(
draggable,
$.extend( inst, { offset: inst.element.offset() } ),
inst.options.tolerance, event
)
) {
childrenIntersection = true;
return false; }
} );
if ( childrenIntersection ) {
return false;
}

if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
if ( this.accept.call( this.element[ 0 ],
( draggable.currentItem || draggable.element ) ) ) {
this._removeActiveClass();
this._removeHoverClass();

Expand Down Expand Up @@ -247,8 +265,10 @@ var intersect = ( function() {
return false;
}

var x1 = ( draggable.positionAbs || draggable.position.absolute ).left + draggable.margins.left,
y1 = ( draggable.positionAbs || draggable.position.absolute ).top + draggable.margins.top,
var x1 = ( draggable.positionAbs ||
draggable.position.absolute ).left + draggable.margins.left,
y1 = ( draggable.positionAbs ||
draggable.position.absolute ).top + draggable.margins.top,
x2 = x1 + draggable.helperProportions.width,
y2 = y1 + draggable.helperProportions.height,
l = droppable.offset.left,
Expand All @@ -265,7 +285,8 @@ var intersect = ( function() {
t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
case "pointer":
return isOverAxis( event.pageY, t, droppable.proportions().height ) && isOverAxis( event.pageX, l, droppable.proportions().width );
return isOverAxis( event.pageY, t, droppable.proportions().height ) &&
isOverAxis( event.pageX, l, droppable.proportions().width );
case "touch":
return (
( y1 >= t && y1 <= b ) || // Top edge touching
Expand Down Expand Up @@ -298,7 +319,8 @@ $.ui.ddmanager = {
droppablesLoop: for ( i = 0; i < m.length; i++ ) {

// No disabled and non-accepted
if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ], ( t.currentItem || t.element ) ) ) ) {
if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ],
( t.currentItem || t.element ) ) ) ) {
continue;
}

Expand All @@ -321,7 +343,10 @@ $.ui.ddmanager = {
}

m[ i ].offset = m[ i ].element.offset();
m[ i ].proportions( { width: m[ i ].element[ 0 ].offsetWidth, height: m[ i ].element[ 0 ].offsetHeight } );
m[ i ].proportions( {
width: m[ i ].element[ 0 ].offsetWidth,
height: m[ i ].element[ 0 ].offsetHeight
} );

}

Expand All @@ -336,11 +361,13 @@ $.ui.ddmanager = {
if ( !this.options ) {
return;
}
if ( !this.options.disabled && this.visible && intersect( draggable, this, this.options.tolerance, event ) ) {
if ( !this.options.disabled && this.visible &&
intersect( draggable, this, this.options.tolerance, event ) ) {
dropped = this._drop.call( this, event ) || dropped;
}

if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ],
( draggable.currentItem || draggable.element ) ) ) {
this.isout = true;
this.isover = false;
this._deactivate.call( this, event );
Expand All @@ -352,7 +379,8 @@ $.ui.ddmanager = {
},
dragStart: function( draggable, event ) {

// Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
// Listen for scrolling so that if the dragging causes scrolling the position of the
// droppables can be recalculated (see #5003)
draggable.element.parentsUntil( "body" ).on( "scroll.droppable", function() {
if ( !draggable.options.refreshPositions ) {
$.ui.ddmanager.prepareOffsets( draggable, event );
Expand All @@ -361,7 +389,8 @@ $.ui.ddmanager = {
},
drag: function( draggable, event ) {

// If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
// If you have a highly dynamic page, you might try this option. It renders positions
// every time you move the mouse.
if ( draggable.options.refreshPositions ) {
$.ui.ddmanager.prepareOffsets( draggable, event );
}
Expand All @@ -375,7 +404,9 @@ $.ui.ddmanager = {

var parentInstance, scope, parent,
intersects = intersect( draggable, this, this.options.tolerance, event ),
c = !intersects && this.isover ? "isout" : ( intersects && !this.isover ? "isover" : null );
c = !intersects && this.isover ?
"isout" :
( intersects && !this.isover ? "isover" : null );
if ( !c ) {
return;
}
Expand Down Expand Up @@ -417,7 +448,8 @@ $.ui.ddmanager = {
dragStop: function( draggable, event ) {
draggable.element.parentsUntil( "body" ).off( "scroll.droppable" );

// Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
// Call prepareOffsets one final time since IE does not fire return scroll events when
// overflow was caused by drag (see #5003)
if ( !draggable.options.refreshPositions ) {
$.ui.ddmanager.prepareOffsets( draggable, event );
}
Expand Down