commit/galaxy-central: jgoecks: Make trackster View object into a Backbone view.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/9018e5bb4e6e/ changeset: 9018e5bb4e6e user: jgoecks date: 2012-10-22 18:33:30 summary: Make trackster View object into a Backbone view. affected #: 2 files diff -r 60fee5ee38fada926d010971e49623367b78362e -r 9018e5bb4e6e6de8b52683d2377d449b417269af static/scripts/viz/trackster/tracks.js --- a/static/scripts/viz/trackster/tracks.js +++ b/static/scripts/viz/trackster/tracks.js @@ -854,34 +854,35 @@ }); /** - * View object manages complete viz view, including tracks and user interactions. + * View object manages a trackster visualization, including tracks and user interactions. * Events triggered: * navigate: when browser view changes to a new locations */ -var View = function(obj_dict) { - extend(obj_dict, { - obj_type: "View" - }); - DrawableCollection.call(this, "View", obj_dict.container, obj_dict); - this.chrom = null; - this.vis_id = obj_dict.vis_id; - this.dbkey = obj_dict.dbkey; - this.label_tracks = []; - this.tracks_to_be_redrawn = []; - this.max_low = 0; - this.max_high = 0; - this.zoom_factor = 3; - this.min_separation = 30; - this.has_changes = false; - // Deferred object that indicates when view's chrom data has been loaded. - this.load_chroms_deferred = null; - this.init(); - this.canvas_manager = new visualization.CanvasManager( this.container.get(0).ownerDocument ); - this.reset(); -}; -_.extend( View.prototype, Backbone.Events); -extend( View.prototype, DrawableCollection.prototype, { - init: function() { +var TracksterView = Backbone.View.extend({ + + initialize: function(obj_dict) { + extend(obj_dict, { + obj_type: "View" + }); + DrawableCollection.call(this, "View", obj_dict.container, obj_dict); + this.chrom = null; + this.vis_id = obj_dict.vis_id; + this.dbkey = obj_dict.dbkey; + this.label_tracks = []; + this.tracks_to_be_redrawn = []; + this.max_low = 0; + this.max_high = 0; + this.zoom_factor = 3; + this.min_separation = 30; + this.has_changes = false; + // Deferred object that indicates when view's chrom data has been loaded. + this.load_chroms_deferred = null; + this.render(); + this.canvas_manager = new visualization.CanvasManager( this.container.get(0).ownerDocument ); + this.reset(); + }, + + render: function() { // Attribute init. this.requested_redraw = false; @@ -1101,7 +1102,11 @@ this.reset(); $(window).trigger("resize"); - }, + } +}); + +// FIXME: need to use this approach to enable inheritance of DrawableCollection functions. +extend( TracksterView.prototype, DrawableCollection.prototype, { changed: function() { this.has_changes = true; }, @@ -4178,7 +4183,7 @@ }; return { - View: View, + TracksterView: TracksterView, DrawableGroup: DrawableGroup, LineTrack: LineTrack, FeatureTrack: FeatureTrack, diff -r 60fee5ee38fada926d010971e49623367b78362e -r 9018e5bb4e6e6de8b52683d2377d449b417269af static/scripts/viz/trackster_ui.js --- a/static/scripts/viz/trackster_ui.js +++ b/static/scripts/viz/trackster_ui.js @@ -186,7 +186,7 @@ // Create view. var self = this, - view = new tracks.View(view_config); + view = new tracks.TracksterView(view_config); view.editor = true; $.when( view.load_chroms_deferred ).then(function() { // Viewport config. 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)
-
Bitbucket