@@ -84,9 +84,11 @@ export class GridStackEngine {
8484
8585 let didMove = false ;
8686 let newOpt : GridStackMoveOpts = { nested : true , pack : false , sanitize : false } ;
87- while ( collide = collide || this . collide ( node , nn ) ) { // we could start colliding more than 1 item... so repeat for each
87+ while ( collide = collide || this . collide ( node , nn ) ) { // could collide with more than 1 item... so repeat for each
8888 let moved : boolean ;
89- // if colliding with locked item, OR moving down to a different sized item (not handle with swap) that could take our place, move ourself past instead
89+ // if colliding with locked item, OR moving down to a different sized item
90+ // (not handled with swap) that could take our place, move ourself past it instead
91+ // but remember that skip down so we only do this one (and push others otherwise).
9092 if ( collide . locked || ( node . _moving && ! node . _skipDown && nn . y > node . y &&
9193 ! this . float && ! this . collide ( collide , { ...collide , y : node . y } , node ) ) &&
9294 Utils . isIntercepted ( collide , { x : node . x - 0.5 , y : node . y - 0.5 , w : node . w + 1 , h : node . h + 1 } ) ) {
@@ -96,7 +98,7 @@ export class GridStackEngine {
9698 if ( collide . locked && moved ) {
9799 Utils . copyPos ( nn , node ) ; // moving after lock become our new desired location
98100 } else if ( moved && opt . pack && ! collide . locked ) {
99- // we moved after and are will pack, do it now and keep the original drop location to see what else we might push way
101+ // we moved after and will pack: do it now and keep the original drop location to see what else we might push way
100102 this . _packNodes ( ) ;
101103 }
102104 didMove = didMove || moved ;
@@ -534,10 +536,11 @@ export class GridStackEngine {
534536
535537 /** true if x,y or w,h are different after clamping to min/max */
536538 public changedPosConstrain ( node : GridStackNode , p : GridStackPosition ) : boolean {
537- if ( node . x !== p . x || node . y !== p . y ) return true ;
538- // check constrained w,h
539+ // make sure w,h are set
539540 p . w = p . w || node . w ;
540541 p . h = p . h || node . h ;
542+ if ( node . x !== p . x || node . y !== p . y ) return true ;
543+ // check constrained w,h
541544 if ( node . maxW ) { p . w = Math . min ( p . w , node . maxW ) ; }
542545 if ( node . maxH ) { p . h = Math . min ( p . h , node . maxH ) ; }
543546 if ( node . minW ) { p . w = Math . max ( p . w , node . minW ) ; }
0 commit comments