Skip to content

Commit

Permalink
fix: #511 - Update ClusterItem.js isVisible issue (#532)
Browse files Browse the repository at this point in the history
* Update ClusterItem.js

* Update ClusterGenerator.js
  • Loading branch information
lmdc45 authored Jun 20, 2020
1 parent cce1a85 commit a3b2ccf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/timeline/component/ClusterGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down
2 changes: 1 addition & 1 deletion lib/timeline/component/item/ClusterItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit a3b2ccf

Please sign in to comment.