Skip to content

Commit

Permalink
make the GenomeView keep a reference to the browser object, and use t…
Browse files Browse the repository at this point in the history
…he Browser object's wrapped pub/sub methods
  • Loading branch information
rbuels committed May 10, 2012
1 parent cb05872 commit 0d9296f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion js/Browser.js
Expand Up @@ -163,7 +163,7 @@ Browser.prototype.initView = function() {

// hook up GenomeView
this.view = this.viewElem.view =
new GenomeView(this.viewElem, 250, this.refSeq, 1/200,
new GenomeView(this, this.viewElem, 250, this.refSeq, 1/200,
this.config.browserRoot);
dojo.connect( this.view, "onFineMove", this, "onFineMove" );
dojo.connect( this.view, "onCoarseMove", this, "onCoarseMove" );
Expand Down
11 changes: 7 additions & 4 deletions js/GenomeView.js
Expand Up @@ -4,7 +4,10 @@
* @class
* @constructor
*/
function GenomeView(elem, stripeWidth, refseq, zoomLevel, browserRoot) {
function GenomeView( browser, elem, stripeWidth, refseq, zoomLevel, browserRoot) {

// keep a reference to the main browser object
this.browser = browser;

var seqCharSize = this.calculateSequenceCharacterSize( elem );
this.charWidth = seqCharSize.width;
Expand Down Expand Up @@ -172,9 +175,9 @@ function GenomeView(elem, stripeWidth, refseq, zoomLevel, browserRoot) {
});

// subscribe to showTracks commands
dojo.subscribe( '/dnd/drop',dojo.hitch(this, 'updateTrackList'));
dojo.subscribe( '/jbrowse/v1/c/tracks/show', this, 'showTracks' );
dojo.subscribe( '/jbrowse/v1/c/tracks/hide', this, 'hideTracks' );
this.browser.subscribe( '/dnd/drop',dojo.hitch(this, 'updateTrackList'));
this.browser.subscribe( '/jbrowse/v1/c/tracks/show', this, 'showTracks' );
this.browser.subscribe( '/jbrowse/v1/c/tracks/hide', this, 'hideTracks' );

// render our UI tracks (horizontal scale tracks, grid lines, and so forth)
dojo.forEach(this.uiTracks, function(track) {
Expand Down

0 comments on commit 0d9296f

Please sign in to comment.