You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/CHANGES.md
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -95,6 +95,7 @@ Change log
95
95
96
96
## 8.4.0-dev (TBD)
97
97
- feat [#404](https://github.com/gridstack/gridstack.js/issues/404) added `GridStackOptions.fitToContent` and `GridStackWidget.fitToContent` to make gridItems size themselves to their content (no scroll bar), calling `GridStack.resizeToContent(el)` whenever the grid or item is resized.
98
+
- also added new `'resizecontent'` event, and `resizeToContentCB` and `resizeToContentParent` vars.
98
99
- fix [#2406](https://github.com/gridstack/gridstack.js/issues/2406) inf loop when autoPosition after loading into 1 column, then 2.
constwantedH=(item.firstChildasElement)?.clientHeight||itemH;// NOTE: clientHeight & getBoundingClientRect() is undefined for text and other leaf nodes. use <div> container!
1271
+
constitemH=item.clientHeight;// available height to our child (minus border, padding...)
1272
+
constwantedH=(item.firstChildasElement)?.getBoundingClientRect().height||itemH;// NOTE: clientHeight & getBoundingClientRect() is undefined for text and other leaf nodes. use <div> container!
1267
1273
if(itemH===wantedH)return;
1268
1274
height+=wantedH-itemH;
1269
1275
constcell=this.getCellHeight();
1270
1276
if(!cell)return;
1271
1277
leth=Math.ceil(height/cell);
1272
1278
if(n.maxH&&h>n.maxH)h=n.maxH;
1273
-
if(h!==n.h)this.moveNode(n,{h});
1279
+
if(h!==n.h){
1280
+
this._ignoreLayoutsNodeChange=true;
1281
+
this.moveNode(n,{h});
1282
+
deletethis._ignoreLayoutsNodeChange;
1283
+
}
1274
1284
});
1275
1285
}
1286
+
1287
+
/** call the user resize (so we can do extra work) else our build in version */
* Updates the margins which will set all 4 sides at once - see `GridStackOptions.margin` for format options (CSS string format of 1,2,4 values or single number).
@@ -1608,18 +1624,29 @@ export class GridStack {
1608
1624
// update any nested grids, or items size
1609
1625
this.engine.nodes.forEach(n=>{
1610
1626
if(n.subGrid)n.subGrid.onResize()
1611
-
// update any gridItem height with fitToContent, but wait for DOM $animation_speed to settle if we changed column count
1612
-
// TODO: is there a way to know what the final (post animation) size of the content will be so we can animate the column width and height together rather than sequentially ?
// update any gridItem height with fitToContent, but wait for DOM $animation_speed to settle if we changed column count
1637
+
// TODO: is there a way to know what the final (post animation) size of the content will be so we can animate the column width and height together rather than sequentially ?
0 commit comments