commit/galaxy-central: jgoecks: Trackster: draw incomplete features only once.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/f002131cb905/ Changeset: f002131cb905 User: jgoecks Date: 2014-07-25 18:01:34 Summary: Trackster: draw incomplete features only once. Affected #: 1 file diff -r e359c370aeac38cafa61c01112c09c1560153523 -r f002131cb905ad4e578635c8a8b655e07cf701f0 static/scripts/viz/trackster/tracks.js --- a/static/scripts/viz/trackster/tracks.js +++ b/static/scripts/viz/trackster/tracks.js @@ -1907,6 +1907,8 @@ this.feature_mapper = feature_mapper; this.has_icons = false; this.incomplete_features = incomplete_features; + // Features drawn based on data from other tiles. + this.other_tiles_features_drawn = {}; this.seq_data = seq_data; // Add message + action icons to tile's html. @@ -3714,7 +3716,8 @@ }); // - // Draw incomplete features across tiles. + // Finish drawing of features that span multiple tiles. Features that span multiple tiles + // are labeled incomplete on the tile level because they cannot be completely drawn. // if (line_track_tiles.length === 0) { // Gather incomplete features together. @@ -3728,19 +3731,31 @@ // Draw incomplete features on each tile. var self = this; _.each(tiles, function(tile) { - // To draw incomplete features, copy original canvas and then draw incomplete features - // on the canvas. - var features = { data: _.values( all_incomplete_features ) }, - new_canvas = self.view.canvas_manager.new_canvas(); - new_canvas.height = self.get_canvas_height(features, tile.mode, tile.w_scale, 100); - new_canvas.width = tile.canvas.width; - new_canvas.getContext('2d').drawImage(tile.canvas, 0, 0); - new_canvas.getContext('2d').translate(track.left_offset, 0); - var new_tile = self.draw_tile(features, new_canvas.getContext('2d'), - tile.mode, tile.region, tile.w_scale, tile.seq_data); - $(new_tile.canvas).addClass('incomplete_features'); - $(tile.canvas).replaceWith($(new_tile.canvas)); - tile.canvas = new_canvas; + // Remove features already drawn on tile originally. + var tile_incomplete_features =_.omit(all_incomplete_features, + _.map(tile.incomplete_features, function(f) { return f[0]; })); + + // Remove features already drawn on tile in past postdraw actions. + tile_incomplete_features = _.omit(tile_incomplete_features, _.keys(tile.other_tiles_features_drawn)); + + // Draw tile's incomplete features. + if (_.size(tile_incomplete_features) !== 0) { + // To draw incomplete features, create new canvas, copy original canvas/tile onto new + // canvas, and then draw incomplete features on the new canvas. + var features = { data: _.values( tile_incomplete_features ) }, + new_canvas = self.view.canvas_manager.new_canvas(), + new_canvas_ctx = new_canvas.getContext('2d'); + new_canvas.height = Math.max(tile.canvas.height, + self.get_canvas_height(features, tile.mode, tile.w_scale, 100)); + new_canvas.width = tile.canvas.width; + new_canvas_ctx.drawImage(tile.canvas, 0, 0); + new_canvas_ctx.translate(track.left_offset, 0); + var new_tile = self.draw_tile(features, new_canvas_ctx, tile.mode, + tile.region, tile.w_scale, tile.seq_data); + $(tile.canvas).replaceWith($(new_tile.canvas)); + tile.canvas = new_canvas; + _.extend(tile.other_tiles_features_drawn, all_incomplete_features); + } }); } Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org