@@ -420,6 +420,7 @@ GridStack.prototype._prepareDragDropByNode = function(node: GridStackNode): Grid
420
420
}
421
421
}
422
422
423
+ this . _extraDragRow = 0 ;
423
424
this . _updateContainerHeight ( ) ;
424
425
this . _triggerChangeEvent ( ) ;
425
426
@@ -537,6 +538,19 @@ GridStack.prototype._dragOrResize = function(el: GridItemHTMLElement, event: Eve
537
538
let top = ui . position . top + ( ui . position . top > node . _lastUiPosition . top ? - this . opts . marginBottom : this . opts . marginTop ) ;
538
539
p . x = Math . round ( left / cellWidth ) ;
539
540
p . y = Math . round ( top / cellHeight ) ;
541
+
542
+ // if we're at the bottom hitting something else, grow the grid so cursor doesn't leave when trying to place below others
543
+ let prev = this . _extraDragRow ;
544
+ if ( this . engine . collide ( node , p ) ) {
545
+ let row = this . getRow ( ) ;
546
+ let extra = Math . max ( 0 , ( p . y + node . h ) - row ) ;
547
+ if ( this . opts . maxRow && row + extra > this . opts . maxRow ) {
548
+ extra = Math . max ( 0 , this . opts . maxRow - row ) ;
549
+ }
550
+ this . _extraDragRow = extra ;
551
+ } else this . _extraDragRow = 0 ;
552
+ if ( this . _extraDragRow !== prev ) this . _updateContainerHeight ( ) ;
553
+
540
554
if ( node . x === p . x && node . y === p . y ) return ; // skip same
541
555
// DON'T skip one we tried as we might have failed because of coverage <50% before
542
556
// if (node._lastTried && node._lastTried.x === x && node._lastTried.y === y) return;
@@ -570,6 +584,7 @@ GridStack.prototype._dragOrResize = function(el: GridItemHTMLElement, event: Eve
570
584
this . engine . cacheRects ( cellWidth , cellHeight , this . opts . marginTop , this . opts . marginRight , this . opts . marginBottom , this . opts . marginLeft ) ;
571
585
delete node . _skipDown ;
572
586
if ( resizing && node . subGrid ) { ( node . subGrid as GridStack ) . onParentResize ( ) ; }
587
+ this . _extraDragRow = 0 ;
573
588
this . _updateContainerHeight ( ) ;
574
589
575
590
let target = event . target as GridItemHTMLElement ;
0 commit comments