diff --git a/lib/timeline/component/ClusterGenerator.js b/lib/timeline/component/ClusterGenerator.js index 6032b590a7..b07c056eab 100644 --- a/lib/timeline/component/ClusterGenerator.js +++ b/lib/timeline/component/ClusterGenerator.js @@ -154,7 +154,7 @@ export default class ClusterGenerator { // and calculate the average start for the cluster let m = i; while (clusterItems.length < num && m < items.length) { - if (clusterCriteria(items[m].data, items[m].data)) { + if (clusterCriteria(items[i].data, items[m].data)) { clusterItems.push(items[m]); } m++; diff --git a/lib/timeline/component/item/ClusterItem.js b/lib/timeline/component/item/ClusterItem.js index 127f0a9627..48b884730c 100644 --- a/lib/timeline/component/item/ClusterItem.js +++ b/lib/timeline/component/item/ClusterItem.js @@ -70,7 +70,7 @@ class ClusterItem extends Item { isVisible(range) { const rangeWidth = this.data.end ? this.data.end - this.data.start : 0; const widthInMs = this.width * range.getMillisecondsPerPixel(); - const end = Math.max(rangeWidth, this.data.start.getTime() + widthInMs); + const end = Math.max(this.data.start.getTime() + rangeWidth, this.data.start.getTime() + widthInMs); return (this.data.start < range.end) && (end > range.start) && this.hasItems(); }