Skip to content

Commit

Permalink
Fix flickering of gene tracks when zooming.
Browse files Browse the repository at this point in the history
  • Loading branch information
dasmoth committed Jan 16, 2014
1 parent 3f3aedb commit 6f1c8de
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 9 deletions.
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ For 0.12
- Animate when leaping/toggling.
- Apply track-edit operations to multiple tracks at once.
- Bulk addition of local files.
- Search-by-name (or description) in track-adder.

For 0.13
--------
Expand Down
12 changes: 7 additions & 5 deletions js/feature-draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,26 @@ function drawFeatureTier(tier)
}
}

// Merge supergroups
// Merge supergroups

if (tier.dasSource.collapseSuperGroups && !tier.bumped) {
for (var sg in tier.superGroups) {
var sgg = tier.superGroups[sg];
tier.groups[sg] = shallowCopy(tier.groups[sg]);
tier.groups[sg].type = tier.groups[sgg[0]].type; // HACK to make styling easier in DAS1.6
var featsByType = {};
for (var g = 0; g < sgg.length; ++g) {
var gf = tier.groupedFeatures[sgg[g]];
if (!gf)
continue;

for (var fi = 0; fi < gf.length; ++fi) {
var f = gf[fi];
pusho(featsByType, f.type, f);
}

if (tier.groups[sg] && !tier.groups[sg].links || tier.groups[sg].links.length == 0) {
tier.groups[sg].links = tier.groups[sgg[0]].links;
tier.groups[sg].links = tier.groups[sgg[0]].links;
}

delete tier.groupedFeatures[sgg[g]]; // 'cos we don't want to render the unmerged version.
Expand Down Expand Up @@ -209,8 +213,6 @@ function drawFeatureTier(tier)
}
}



// Bumping

var unbumpedST = new SubTier();
Expand Down
25 changes: 21 additions & 4 deletions js/features.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
function sortFeatures(tier)
{
var dmin = tier.browser.drawnStart, dmax = tier.browser.drawnEnd;
var ungroupedFeatures = {};
var groupedFeatures = {};
var drawnGroupedFeatures = {};
var groupMins = {}, groupMaxes = {};
var groups = {};
var superGroups = {};
var groupsToSupers = {};
Expand Down Expand Up @@ -38,14 +41,14 @@ function sortFeatures(tier)
return spids;
}


for (var fi = 0; fi < tier.currentFeatures.length; ++fi) {
// var f = eval('[' + miniJSONify(tier.currentFeatures[fi]) + ']')[0];
var f = tier.currentFeatures[fi];
if (f.parts) {
continue;
}

var drawn = f.min <= dmax && f.max >= dmin;

if (!f.min || !f.max) {
nonPositional.push(f);
continue;
Expand Down Expand Up @@ -77,6 +80,14 @@ function sortFeatures(tier)
pusho(groupedFeatures, gid, f);
groups[gid] = g;
fGroups.push(gid);

var ogm = groupMins[gid];
if (!ogm || f.min < ogm)
groupMins[gid] = f.min;

ogm = groupMaxes[gid];
if (!ogm || f.max > ogm)
groupMaxes[gid] = f.max;
}
}
}
Expand Down Expand Up @@ -124,7 +135,8 @@ function sortFeatures(tier)
}

if (fGroups.length == 0) {
pusho(ungroupedFeatures, f.type, f);
if (drawn)
pusho(ungroupedFeatures, f.type, f);
} else if (fSuperGroup) {
for (var g = 0; g < fGroups.length; ++g) {
var gid = fGroups[g];
Expand All @@ -134,8 +146,13 @@ function sortFeatures(tier)
}
}

for (var gid in groupedFeatures) {
if (groupMaxes[gid] >= dmin && groupMins[gid] <= dmax)
drawnGroupedFeatures[gid] = groupedFeatures[gid];
}

tier.ungroupedFeatures = ungroupedFeatures;
tier.groupedFeatures = groupedFeatures;
tier.groupedFeatures = drawnGroupedFeatures;
tier.groups = groups;
tier.superGroups = superGroups;
tier.groupsToSupers = groupsToSupers;
Expand Down
6 changes: 6 additions & 0 deletions js/kspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ KnownSpace.prototype.startFetchesForTiers = function(tiers) {
var awaitedSeq = this.awaitedSeq;
var needSeq = false;

var gex;

for (var t = 0; t < tiers.length; ++t) {
try {
if (this.startFetchesFor(tiers[t], awaitedSeq)) {
Expand All @@ -135,6 +137,7 @@ KnownSpace.prototype.startFetchesForTiers = function(tiers) {
tiers[t].updateStatus(ex);
console.log('Error fetching tier source');
console.log(ex);
gex = ex;
}
}

Expand Down Expand Up @@ -171,6 +174,9 @@ KnownSpace.prototype.startFetchesForTiers = function(tiers) {
}
});
}

if (gex)
throw gex;
}

KnownSpace.prototype.startFetchesFor = function(tier, awaitedSeq) {
Expand Down

0 comments on commit 6f1c8de

Please sign in to comment.