@@ -101,7 +101,7 @@ GridStack.prototype._setupAcceptWidget = function(): GridStack {
101101 this . engine . beginUpdate ( node ) ;
102102 this . engine . addNode ( node ) ;
103103
104- this . _writeAttrs ( this . placeholder , node . x , node . y , node . w , node . h ) ;
104+ this . _writePosAttr ( this . placeholder , node . x , node . y , node . w , node . h ) ;
105105 this . el . appendChild ( this . placeholder ) ;
106106 node . el = this . placeholder ; // dom we update while dragging...
107107 node . _beforeDragX = node . x ;
@@ -354,29 +354,22 @@ GridStack.prototype._prepareDragDropByNode = function(node: GridStackNode): Grid
354354
355355 this . engine . cleanNodes ( ) ;
356356 this . engine . beginUpdate ( node ) ;
357- cellWidth = this . cellWidth ( ) ;
358- cellHeight = this . getCellHeight ( true ) ; // force pixels for calculations
359357
360- this . placeholder . setAttribute ( 'gs-x' , target . getAttribute ( 'gs-x' ) ) ;
361- this . placeholder . setAttribute ( 'gs-y' , target . getAttribute ( 'gs-y' ) ) ;
362- this . placeholder . setAttribute ( 'gs-w' , target . getAttribute ( 'gs-w' ) ) ;
363- this . placeholder . setAttribute ( 'gs-h' , target . getAttribute ( 'gs-h' ) ) ;
358+ this . _writePosAttr ( this . placeholder , node . x , node . y , node . w , node . h )
364359 this . el . append ( this . placeholder ) ;
365360
366361 node . el = this . placeholder ;
367362 node . _beforeDragX = node . x ;
368363 node . _beforeDragY = node . y ;
369364 node . _prevYPix = ui . position . top ;
370365
366+ // set the min/max resize info
367+ cellWidth = this . cellWidth ( ) ;
368+ cellHeight = this . getCellHeight ( true ) ; // force pixels for calculations
371369 GridStackDD . get ( ) . resizable ( el , 'option' , 'minWidth' , cellWidth * ( node . minW || 1 ) ) ;
372370 GridStackDD . get ( ) . resizable ( el , 'option' , 'minHeight' , cellHeight * ( node . minH || 1 ) ) ;
373- // also set max if set #1330
374- if ( node . maxW ) {
375- GridStackDD . get ( ) . resizable ( el , 'option' , 'maxWidth' , cellWidth * node . maxW ) ;
376- }
377- if ( node . maxH ) {
378- GridStackDD . get ( ) . resizable ( el , 'option' , 'maxHeight' , cellHeight * node . maxH ) ;
379- }
371+ if ( node . maxW ) { GridStackDD . get ( ) . resizable ( el , 'option' , 'maxWidth' , cellWidth * node . maxW ) ; }
372+ if ( node . maxH ) { GridStackDD . get ( ) . resizable ( el , 'option' , 'maxHeight' , cellHeight * node . maxH ) ; }
380373 }
381374
382375 /** called when item is being dragged/resized */
@@ -413,7 +406,7 @@ GridStack.prototype._prepareDragDropByNode = function(node: GridStackNode): Grid
413406
414407 if ( node . _temporaryRemoved ) {
415408 this . engine . addNode ( node ) ;
416- this . _writeAttrs ( this . placeholder , x , y , w , h ) ;
409+ this . _writePosAttr ( this . placeholder , x , y , w , h ) ;
417410 this . el . appendChild ( this . placeholder ) ;
418411 node . el = this . placeholder ;
419412 delete node . _temporaryRemoved ;
@@ -464,10 +457,10 @@ GridStack.prototype._prepareDragDropByNode = function(node: GridStackNode): Grid
464457 this . _clearRemovingTimeout ( el ) ;
465458 if ( ! node . _temporaryRemoved ) {
466459 Utils . removePositioningStyles ( target ) ;
467- this . _writeAttrs ( target , node . x , node . y , node . w , node . h ) ;
460+ this . _writePosAttr ( target , node . x , node . y , node . w , node . h ) ;
468461 } else {
469462 Utils . removePositioningStyles ( target ) ;
470- this . _writeAttrs ( target , node . _beforeDragX , node . _beforeDragY , node . w , node . h ) ;
463+ this . _writePosAttr ( target , node . _beforeDragX , node . _beforeDragY , node . w , node . h ) ;
471464 node . x = node . _beforeDragX ;
472465 node . y = node . _beforeDragY ;
473466 delete node . _temporaryRemoved ;
0 commit comments