@@ -420,6 +420,7 @@ GridStack.prototype._prepareDragDropByNode = function(node: GridStackNode): Grid
420420 }
421421 }
422422
423+ this . _extraDragRow = 0 ;
423424 this . _updateContainerHeight ( ) ;
424425 this . _triggerChangeEvent ( ) ;
425426
@@ -537,6 +538,19 @@ GridStack.prototype._dragOrResize = function(el: GridItemHTMLElement, event: Eve
537538 let top = ui . position . top + ( ui . position . top > node . _lastUiPosition . top ? - this . opts . marginBottom : this . opts . marginTop ) ;
538539 p . x = Math . round ( left / cellWidth ) ;
539540 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+
540554 if ( node . x === p . x && node . y === p . y ) return ; // skip same
541555 // DON'T skip one we tried as we might have failed because of coverage <50% before
542556 // if (node._lastTried && node._lastTried.x === x && node._lastTried.y === y) return;
@@ -570,6 +584,7 @@ GridStack.prototype._dragOrResize = function(el: GridItemHTMLElement, event: Eve
570584 this . engine . cacheRects ( cellWidth , cellHeight , this . opts . marginTop , this . opts . marginRight , this . opts . marginBottom , this . opts . marginLeft ) ;
571585 delete node . _skipDown ;
572586 if ( resizing && node . subGrid ) { ( node . subGrid as GridStack ) . onParentResize ( ) ; }
587+ this . _extraDragRow = 0 ;
573588 this . _updateContainerHeight ( ) ;
574589
575590 let target = event . target as GridItemHTMLElement ;
0 commit comments