From f514b9471e92fa2a79f2781059569ee998f86efb Mon Sep 17 00:00:00 2001 From: Jeremy Goecks Date: Thu, 14 Apr 2011 14:34:39 -0400 Subject: [PATCH] Create and use ReferenceTrackDataManager to fetch ReferenceTrack data. --- static/scripts/trackster.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/static/scripts/trackster.js b/static/scripts/trackster.js index bdbc3e1b46f..c8edf24925e 100644 --- a/static/scripts/trackster.js +++ b/static/scripts/trackster.js @@ -244,11 +244,6 @@ extend(DataManager.prototype, Cache.prototype, { * Load data from server; returns AJAX object so that use of Deferred is possible. */ load_data: function(chrom, low, high, mode, resolution, extra_params) { - if (this.track.track_type == "ReferenceTrack" && resolution > 1) { - // Now that data is pre-fetched before draw, we don't load reference tracks - // unless it's at the bottom level - return; - } // Setup data request params. var params = {"chrom": chrom, "low": low, "high": high, "mode": mode, "resolution": resolution, "dataset_id" : this.track.dataset_id, @@ -346,6 +341,20 @@ extend(DataManager.prototype, Cache.prototype, { } }); +var ReferenceTrackDataManager = function(num_elements, track, subset) { + DataManager.call(this, num_elements, track, subset); +}; +extend(ReferenceTrackDataManager.prototype, DataManager.prototype, Cache.prototype, { + load_data: function(chrom, low, high, mode, resolution, extra_params) { + if (resolution > 1) { + // Now that data is pre-fetched before draw, we don't load reference tracks + // unless it's at the bottom level + return; + } + return DataManager.prototype.load_data.call(this, chrom, low, high, mode, resolution, extra_params); + } +}); + /** * View object manages complete viz view, including tracks and user interactions. */ @@ -1979,7 +1988,7 @@ var ReferenceTrack = function (view) { this.content_div.css("border", "none"); this.data_url = reference_url; this.data_url_extra_params = {dbkey: view.dbkey}; - this.data_cache = new DataManager(CACHED_DATA, this, false); + this.data_cache = new ReferenceTrackDataManager(CACHED_DATA, this, false); this.tile_cache = new Cache(CACHED_TILES_LINE); }; extend(ReferenceTrack.prototype, TiledTrack.prototype, {