@@ -498,41 +498,41 @@ export default function sortableContainer(WrappedComponent, config = {withRef: f
498498 if ( this . axis . y ) {
499499 // Calculations for a grid setup
500500 if (
501- ( index < this . index )
502- && (
503- ( ( sortingOffset . left - offset . width <= edgeOffset . left ) && ( sortingOffset . top <= edgeOffset . top + offset . height ) )
504- || ( sortingOffset . top + offset . height <= edgeOffset . top )
505- )
506- ) {
501+ ( index < this . index )
502+ && (
503+ ( ( sortingOffset . left - offset . width <= edgeOffset . left ) && ( sortingOffset . top <= edgeOffset . top + offset . height ) )
504+ || ( sortingOffset . top + offset . height <= edgeOffset . top )
505+ )
506+ ) {
507507 // If the current node is to the left on the same row, or above the node that's being dragged
508508 // then move it to the right
509- translate . x = this . width + this . marginOffset . x ;
510- if ( edgeOffset . left + translate . x > this . containerBoundingRect . width - offset . width ) {
509+ translate . x = this . width + this . marginOffset . x ;
510+ if ( edgeOffset . left + translate . x > this . containerBoundingRect . width - offset . width ) {
511511 // If it moves passed the right bounds, then animate it to the first position of the next row.
512512 // We just use the offset of the next node to calculate where to move, because that node's original position
513513 // is exactly where we want to go
514- translate . x = nextNode . edgeOffset . left - edgeOffset . left ;
515- translate . y = nextNode . edgeOffset . top - edgeOffset . top ;
516- }
517- if ( this . newIndex === null ) {
518- this . newIndex = index ;
519- }
520- } else if ( index > this . index
521- && ( ( ( sortingOffset . left + offset . width >= edgeOffset . left ) && ( sortingOffset . top + offset . height >= edgeOffset . top ) )
522- || ( sortingOffset . top + offset . height >= edgeOffset . top + height ) )
523- ) {
524- // If the current node is to the right on the same row, or below the node that's being dragged
525- // then move it to the left
526- translate . x = - ( this . width + this . marginOffset . x ) ;
527- if ( edgeOffset . left + translate . x < this . containerBoundingRect . left + offset . width ) {
514+ translate . x = nextNode . edgeOffset . left - edgeOffset . left ;
515+ translate . y = nextNode . edgeOffset . top - edgeOffset . top ;
516+ }
517+ if ( this . newIndex === null ) {
518+ this . newIndex = index ;
519+ }
520+ } else if ( index > this . index
521+ && ( ( ( sortingOffset . left + offset . width >= edgeOffset . left ) && ( sortingOffset . top + offset . height >= edgeOffset . top ) )
522+ || ( sortingOffset . top + offset . height >= edgeOffset . top + height ) )
523+ ) {
524+ // If the current node is to the right on the same row, or below the node that's being dragged
525+ // then move it to the left
526+ translate . x = - ( this . width + this . marginOffset . x ) ;
527+ if ( edgeOffset . left + translate . x < this . containerBoundingRect . left + offset . width ) {
528528 // If it moves passed the left bounds, then animate it to the last position of the previous row.
529529 // We just use the offset of the previous node to calculate where to move, because that node's original position
530530 // is exactly where we want to go
531- translate . x = prevNode . edgeOffset . left - edgeOffset . left ;
532- translate . y = prevNode . edgeOffset . top - edgeOffset . top ;
533- }
534- this . newIndex = index ;
535- }
531+ translate . x = prevNode . edgeOffset . left - edgeOffset . left ;
532+ translate . y = prevNode . edgeOffset . top - edgeOffset . top ;
533+ }
534+ this . newIndex = index ;
535+ }
536536 } else {
537537 if ( index > this . index && ( sortingOffset . left + offset . width >= edgeOffset . left ) ) {
538538 translate . x = - ( this . width + this . marginOffset . x ) ;
0 commit comments