diff --git a/HISTORY.md b/HISTORY.md index d9085c83..d3674871 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -6,6 +6,7 @@ http://visjs.org ### Timeline +- Fixed auto detected item type being preferred over the global item `type`. - Throws an error when constructing without new keyword. ### Graph diff --git a/src/timeline/component/ItemSet.js b/src/timeline/component/ItemSet.js index 56dba106..92c45076 100644 --- a/src/timeline/component/ItemSet.js +++ b/src/timeline/component/ItemSet.js @@ -13,7 +13,7 @@ function ItemSet(body, options) { this.body = body; this.defaultOptions = { - type: 'box', + type: null, // 'box', 'point', 'range', 'rangeoverflow' orientation: 'bottom', // 'top' or 'bottom' align: 'center', // alignment of box items stack: true, @@ -673,10 +673,7 @@ ItemSet.prototype._onUpdate = function(ids) { ids.forEach(function (id) { var itemData = me.itemsData.get(id, me.itemOptions), item = me.items[id], - type = itemData.type || - (itemData.start && itemData.end && 'range') || - me.options.type || - 'box'; + type = itemData.type || me.options.type || (itemData.end ? 'range' : 'box'); var constructor = ItemSet.types[type];