446446 var css ;
447447 css = '.' + this . opts . _class + ' .' + this . opts . item_class + '[data-gs-height="' + ( i + 1 ) + '"] { height: ' + ( this . opts . cell_height * ( i + 1 ) + this . opts . vertical_margin * i ) + 'px; }' ;
448448 this . _styles . insertRule ( css , i ) ;
449+ css = '.' + this . opts . _class + ' .' + this . opts . item_class + '[data-gs-min-height="' + ( i + 1 ) + '"] { min-height: ' + ( this . opts . cell_height * ( i + 1 ) + this . opts . vertical_margin * i ) + 'px; }' ;
450+ this . _styles . insertRule ( css , i ) ;
451+ css = '.' + this . opts . _class + ' .' + this . opts . item_class + '[data-gs-max-height="' + ( i + 1 ) + '"] { max-height: ' + ( this . opts . cell_height * ( i + 1 ) + this . opts . vertical_margin * i ) + 'px; }' ;
452+ this . _styles . insertRule ( css , i ) ;
449453 css = '.' + this . opts . _class + ' .' + this . opts . item_class + '[data-gs-y="' + ( i ) + '"] { top: ' + ( this . opts . cell_height * i + this . opts . vertical_margin * i ) + 'px; }' ;
450454 this . _styles . insertRule ( css , i ) ;
451455 }
582586 this . container . append ( el ) ;
583587 this . _prepare_element ( el ) ;
584588 this . _update_container_height ( ) ;
589+
590+ return el ;
585591 } ;
586592
587593 GridStack . prototype . will_it_fit = function ( x , y , width , height , auto_position ) {
724730 return Math . ceil ( o . outerWidth ( ) / o . attr ( 'data-gs-width' ) ) ;
725731 } ;
726732
733+ GridStack . prototype . get_cell_from_pixel = function ( position ) {
734+ var containerPos = this . container . position ( ) ;
735+ var relativeLeft = position . left - containerPos . left ;
736+ var relativeTop = position . top - containerPos . top ;
737+
738+ var column_width = Math . floor ( this . container . width ( ) / this . opts . width ) ;
739+ var row_height = this . opts . cell_height + this . opts . vertical_margin ;
740+
741+ return { x : Math . floor ( relativeLeft / column_width ) , y : Math . floor ( relativeTop / row_height ) } ;
742+ } ;
743+
727744 scope . GridStackUI = GridStack ;
728745
729746 scope . GridStackUI . Utils = Utils ;
737754 } ;
738755
739756 return scope . GridStackUI ;
740- } ) ;
757+ } ) ;
0 commit comments