Skip to content

Commit

Permalink
Merge pull request #376 from hammerlab/invalidate-range
Browse files Browse the repository at this point in the history
Add TiledCanvas.invalidateRange
  • Loading branch information
danvk committed Nov 16, 2015
2 parents f715fa1 + d8f8ac7 commit 5940c70
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/main/GenomeTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ class GenomeTrack extends React.Component {
this.tiles = new GenomeTiledCanvas(this.props.source, this.props.height);

// Visualize new reference data as it comes in from the network.
this.props.source.on('newdata', () => {
this.tiles.invalidateAll();
this.props.source.on('newdata', range => {
this.tiles.invalidateRange(range);
this.updateVisualization();
});

Expand Down
6 changes: 2 additions & 4 deletions src/main/PileupTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,12 @@ class PileupTrack extends React.Component {

this.props.source.on('newdata', range => {
this.updateReads(range);
// TODO: only invalidate tiles in the range
this.tiles.invalidateAll();
this.tiles.invalidateRange(range);
this.updateVisualization();
});
this.props.referenceSource.on('newdata', range => {
this.cache.updateMismatches(range);
// TODO: only invalidate tiles in the range
this.tiles.invalidateAll();
this.tiles.invalidateRange(range);
this.updateVisualization();
});
this.props.source.on('networkprogress', e => {
Expand Down
4 changes: 4 additions & 0 deletions src/main/TiledCanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ class TiledCanvas {
this.tileCache = [];
}

invalidateRange(range: ContigInterval) {
this.tileCache = this.tileCache.filter(tile => !tile.range.chrIntersects(range));
}

heightForRef(ref: string): number {
throw 'Not implemented';
}
Expand Down

0 comments on commit 5940c70

Please sign in to comment.