1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/ae52981af216/ Changeset: ae52981af216 User: jgoecks Date: 2013-05-02 21:14:50 Summary: Trackster: add editable min, max labels to tracks. Affected #: 1 file
diff -r 262842a3689a77687ed3310ce180f5323e32b1b5 -r ae52981af216ff749092ccf16f254e77e8c096fa static/scripts/viz/trackster/tracks.js --- a/static/scripts/viz/trackster/tracks.js +++ b/static/scripts/viz/trackster/tracks.js @@ -2853,7 +2853,10 @@ /** * Actions to be taken before drawing. */ - before_draw: function() {}, + before_draw: function() { + // Clear because this is set when drawing. + this.max_height_px = 0; + },
/** * Draw track. It is possible to force a redraw rather than use cached tiles and/or clear old @@ -2930,11 +2933,15 @@ /** * Add a maximum/minimum label to track. */ - _add_yaxis_label: function(type, val, pref_name) { - var css_class = (type === 'max' ? 'top' : 'bottom'), - text = (type === 'max' ? 'max' : 'min'); - - var label = this.container_div.find(".yaxislabel." + css_class); + _add_yaxis_label: function(type, val, pref_name, on_change) { + var track = this, + css_class = (type === 'max' ? 'top' : 'bottom'), + text = (type === 'max' ? 'max' : 'min'), + // Default action for on_change is to redraw track. + on_change = on_change || function() { + track.request_draw(true); + }, + label = this.container_div.find(".yaxislabel." + css_class);
if (label.length !== 0) { // Label already exists, so update value. @@ -2942,14 +2949,13 @@ } else { // Add label. - var track = this; label = $("<div/>").text(val).make_text_editable({ num_cols: 12, on_finish: function(new_val) { $(".bs-tooltip").remove(); var new_val = parseFloat(new_val); track.prefs[ pref_name ] = (!isNaN(new_val) ? new_val : null); - track.request_draw(true); + on_change(); }, help_text: "Set " + text + " value" }).addClass('yaxislabel ' + css_class).css("color", this.prefs.label_color); @@ -3337,6 +3343,9 @@
unpack_drawables: DrawableCollection.prototype.unpack_drawables,
+ /** + * Change mode for all tracks. + */ change_mode: function(new_mode) { TiledTrack.prototype.change_mode.call(this, new_mode); for (var i = 0; i < this.drawables.length; i++) { @@ -3426,8 +3435,6 @@ // Set up and draw tile. extend(tile_data, kwargs[ 'more_tile_data' ] );
- this.tile_predraw_init(); - var canvas = track.view.canvas_manager.new_canvas(), tile_low = region.get('start'), tile_high = region.get('end'), @@ -3518,9 +3525,11 @@ },
/** - * Actions taken before drawing a tile. + * Actions taken before drawing. */ - tile_predraw_init: function() { + before_draw: function() { + TiledTrack.prototype.before_draw.call(this); + // // Set min, max for LineTracks to be largest min, max. // @@ -3541,6 +3550,8 @@ } } } + this.prefs.min_value = min; + this.prefs.max_value = max;
// Set all tracks to smallest min, biggest max. for (var i = 0; i < this.drawables.length; i++) { @@ -3551,6 +3562,18 @@ },
/** + * Update minimum, maximum for component tracks. + */ + update_all_min_max: function() { + var track = this; + _.each(this.drawables, function(d) { + d.prefs.min_value = track.prefs.min_value; + d.prefs.max_value = track.prefs.max_value; + }); + this.request_draw(true); + }, + + /** * Actions to be taken after draw has been completed. Draw is completed when all tiles have been * drawn/fetched and shown. */ @@ -3572,7 +3595,15 @@ this.draw_helper(true, tile.region, tile.resolution, tile.html_elt.parent(), w_scale, { height: max_height } ); tile.html_elt.remove(); } - } + } + + // Wrap function so that it can be called without object reference. + var track = this, + t = function() { track.update_all_min_max(); }; + + // Add min, max labels. + this._add_yaxis_label('min', this.drawables[0].prefs.min_value, 'min_value', t); + this._add_yaxis_label('max', this.drawables[0].prefs.max_value, 'max_value', t); } });
@@ -3701,6 +3732,12 @@ },
/** + * Actions to be taken before drawing. + */ + // FIXME: can the default behavior be used; right now it breaks during resize. + before_draw: function() {}, + + /** * Draw LineTrack tile. */ draw_tile: function(result, ctx, mode, resolution, region, w_scale) { @@ -3843,14 +3880,6 @@ },
/** - * Actions to be taken before drawing. - */ - before_draw: function() { - // Clear because this is set when drawing. - this.max_height_px = 0; - }, - - /** * Actions to be taken after draw has been completed. Draw is completed when all tiles have been * drawn/fetched and shown. */ @@ -4211,14 +4240,6 @@ },
/** - * Actions to be taken before drawing. - */ - before_draw: function() { - // Clear because this is set when drawing. - this.max_height_px = 0; - }, - - /** * Additional initialization required before drawing track for the first time. */ predraw_init: function() {
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.
galaxy-commits@lists.galaxyproject.org