@@ -716,16 +716,22 @@ import { getDocumentDir } from "../helpers/DOM"
716
716
* Given a height and width in pixel values, calculate grid units.
717
717
* @param {Number} height Height in pixels.
718
718
* @param {Number} width Width in pixels.
719
+ * @param {Boolean} autoSizeFlag function autoSize identifier.
719
720
* @return {Object} w, h as grid units.
720
721
*/
721
- calcWH(height : number , width : number ) {
722
+ calcWH(height : number , width : number , autoSizeFlag = false ) {
722
723
const colWidth = this .calcColWidth ();
723
724
724
725
// width = colWidth * w - (margin * (w - 1))
725
726
// ...
726
727
// w = (width + margin) / (colWidth + margin)
727
728
let w = Math .round ((width + this .margin [0 ]) / (colWidth + this .margin [0 ]));
728
- let h = Math .round ((height + this .margin [1 ]) / (this .rowHeight + this .margin [1 ]));
729
+ let h = 0 ;
730
+ if (! autoSizeFlag ) {
731
+ h = Math .round ((height + this .margin [1 ]) / (this .rowHeight + this .margin [1 ]));
732
+ } else {
733
+ h = Math .ceil ((height + this .margin [1 ]) / (this .rowHeight + this .margin [1 ]));
734
+ }
729
735
730
736
// Capping
731
737
w = Math .max (Math .min (w , this .cols - this .innerX ), 0 );
@@ -819,7 +825,7 @@ import { getDocumentDir } from "../helpers/DOM"
819
825
this .previousH = this .innerH ;
820
826
821
827
let newSize= this .$slots .default [0 ].elm .getBoundingClientRect ();
822
- let pos = this .calcWH (newSize .height , newSize .width );
828
+ let pos = this .calcWH (newSize .height , newSize .width , true );
823
829
if (pos .w < this .minW ) {
824
830
pos .w = this .minW ;
825
831
}
0 commit comments