Browse Source

Fixed zero height of itemSet in case of no DataSet for items

css_transitions
jos 10 years ago
parent
commit
a002f61133
3 changed files with 19 additions and 17 deletions
  1. +6
    -6
      HISTORY.md
  2. +1
    -9
      src/timeline/component/Group.js
  3. +12
    -2
      src/timeline/component/ItemSet.js

+ 6
- 6
HISTORY.md View File

@ -17,19 +17,19 @@ http://visjs.org
- Fixed initial visible window in case items exceed `zoomMax`. Thanks @Remper.
- Option `order` is now deprecated. This was needed for performance improvements.
- Fixed an offset in newly created items when using groups.
- Minor bug fixes.
- More examples added.
### DataSet
- A DataSet can now be constructed with initial data, like
`new DataSet(data, options)`.
- Minor bug fixes.
### Graph
- added recalculate hierarchical layout to update node event.
- added arrowScaleFactor to scale the arrows on the edges.
### DataSet
- A DataSet can now be constructed with initial data, like
`new DataSet(data, options)`.
## 2014-04-18, version 0.7.4

+ 1
- 9
src/timeline/component/Group.js View File

@ -113,21 +113,13 @@ Group.prototype.getLabelWidth = function getLabelWidth() {
/**
* Repaint this group
* @param {{start: number, end: number}} range
* @param {number | {item: number, axis: number}} margin
* @param {{item: number, axis: number}} margin
* @param {boolean} [restack=false] Force restacking of all items
* @return {boolean} Returns true if the group is resized
*/
Group.prototype.repaint = function repaint(range, margin, restack) {
var resized = false;
if (typeof margin === 'number') {
margin = {
item: margin,
axis: margin
};
}
// update visible items
this.visibleItems = this._updateVisibleItems(this.orderedItems, this.visibleItems, range);
// reposition visible items vertically

+ 12
- 2
src/timeline/component/ItemSet.js View File

@ -287,6 +287,14 @@ ItemSet.prototype.repaint = function repaint() {
resized = false,
frame = this.frame;
// TODO: document this feature to specify one margin for both item and axis distance
if (typeof margin === 'number') {
margin = {
item: margin,
axis: margin
};
}
// update className
frame.className = 'itemset' + (options.className ? (' ' + asString(options.className)) : '');
@ -297,12 +305,14 @@ ItemSet.prototype.repaint = function repaint() {
this.lastWidth = this.width;
// repaint all groups
var restack = zoomed || this.stackDirty;
var height = 0;
var restack = zoomed || this.stackDirty,
height = 0,
minHeight = margin.axis + margin.item;
util.forEach(this.groups, function (group) {
resized = group.repaint(range, margin, restack) || resized;
height += group.height;
});
height = Math.max(height, minHeight);
this.stackDirty = false;
// reorder the groups (if needed)

Loading…
Cancel
Save