From 468e613a263adf7d05516696cdce35b84e8c5b83 Mon Sep 17 00:00:00 2001 From: jos Date: Fri, 20 Jun 2014 13:46:16 +0200 Subject: [PATCH] Fixed #172: auto detected item type being preferred over the global item `type`. --- HISTORY.md | 1 + src/timeline/component/ItemSet.js | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) 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];