diff --git a/docs/src/OptionsPage.js b/docs/src/OptionsPage.js index 942b83f..9a1dc43 100644 --- a/docs/src/OptionsPage.js +++ b/docs/src/OptionsPage.js @@ -222,7 +222,12 @@ class OptionsPage extends React.Component { groupHeightMode String 'auto' - Specifies how the height of a group is calculated. Choose from 'auto' and 'fixed'. If it is set to 'auto' the height will be calculated based on the visible items. While if it is set to 'fixed' the group will keep the same height even if there are no visible items in the window. + + Specifies how the height of a group is calculated. Choose from 'auto','fixed', and 'fitItems'.
+ If it is set to 'auto' the height will be calculated based on a group label and visible items.
+ If it is set to 'fitItems' the height will be calculated based on the visible items only.
+ While if it is set to 'fixed' the group will keep the same height even if there are no visible items in the window. + diff --git a/lib/timeline/component/Group.js b/lib/timeline/component/Group.js index d978479..f6db6cf 100644 --- a/lib/timeline/component/Group.js +++ b/lib/timeline/component/Group.js @@ -574,13 +574,13 @@ class Group { }); } height = max + margin.item.vertical / 2; + if (this.heightMode !== "fitItems") { + height = Math.max(height, this.props.label.height); + } } else { - height = 0; + height = 0 || this.props.label.height; } - - height = Math.max(height, this.props.label.height); - return height; } diff --git a/lib/timeline/optionsTimeline.js b/lib/timeline/optionsTimeline.js index 318302d..3a4e300 100644 --- a/lib/timeline/optionsTimeline.js +++ b/lib/timeline/optionsTimeline.js @@ -223,7 +223,7 @@ let configureOptions = { year: '' } }, - groupHeightMode: ['auto', 'fixed'], + groupHeightMode: ['auto', 'fixed', 'fitItems'], //groupOrder: {string, 'function': 'function'}, groupsDraggable: false, height: '',