Skip to content

Commit

Permalink
Fix Merged track popup bug (#1869)
Browse files Browse the repository at this point in the history
  • Loading branch information
milandomazet authored Aug 8, 2024
1 parent e6ce347 commit 3172d44
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions js/feature/mergedTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,14 @@ class MergedTrack extends TrackBase {

const promises = this.tracks.map((t) => t.getFeatures(chr, bpStart, bpEnd, bpPerPixel))
const featureArrays = await Promise.all(promises)
return new MergedFeatureCollection(featureArrays)

if (featureArrays.every((arr) => arr.length === 0)){
return new MergedFeatureCollection([], [])
}
else {
const trackNames = this.tracks.map((t) => t.name)
return new MergedFeatureCollection(featureArrays, trackNames)
}
}

draw(options) {
Expand Down Expand Up @@ -446,8 +453,11 @@ class MergedTrack extends TrackBase {

class MergedFeatureCollection {

constructor(featureArrays) {
constructor(featureArrays,trackNames) {
this.featureArrays = featureArrays
//trackNames is needed for the popup data to populate track names
//preserving the order of the actual tracks
this.trackNames = trackNames
}

getMax(start, end) {
Expand Down

0 comments on commit 3172d44

Please sign in to comment.