diff --git a/js/trackView.js b/js/trackView.js index 0c00f9284..f36842e09 100644 --- a/js/trackView.js +++ b/js/trackView.js @@ -412,7 +412,7 @@ class TrackView { } if (this.track.autoscale) { - let allFeatures + let allFeatures = [] for (let visibleViewport of visibleViewports) { const referenceFrame = visibleViewport.referenceFrame const start = referenceFrame.start @@ -421,15 +421,11 @@ class TrackView { // If the "features" object has a getMax function use it. Currently only alignmentContainer implements this, for coverage. if (typeof visibleViewport.featureCache.features.getMax === 'function') { const max = visibleViewport.featureCache.features.getMax(start, end) - allFeatures = [{value: max}] + allFeatures.push({value: max}) } else { const viewFeatures = FeatureUtils.findOverlapping(visibleViewport.featureCache.features, start, end) - if(!allFeatures) { - allFeatures = viewFeatures - } else { - for(let f of viewFeatures) { - allFeatures.push(f) - } + for (let f of viewFeatures) { + allFeatures.push(f) } } }