Skip to content

Commit

Permalink
pass track object as second argument to getConf calls in Wiggle tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuels committed Feb 21, 2013
1 parent f6ff6f2 commit 124be57
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
7 changes: 4 additions & 3 deletions src/JBrowse/View/Track/Wiggle/Density.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,16 @@ return declare( WiggleBase,
var disableClipMarkers = thisB.config.disable_clip_markers;
var normOrigin = normalize( dataScale.origin );
return function( feature ) {
var confArgs = [ feature, thisB ];
var score = feature.get('score');
var n = normalize( score );
return ( disableClipMarkers || n <= 1 && n >= 0 )
? Color.blendColors(
new Color( thisB.getConf('style.bg_color', arguments ) ),
new Color( thisB.getConf( n >= normOrigin ? 'style.pos_color' : 'style.neg_color', arguments ) ),
new Color( thisB.getConf('style.bg_color', confArgs ) ),
new Color( thisB.getConf( n >= normOrigin ? 'style.pos_color' : 'style.neg_color', confArgs ) ),
Math.abs(n-normOrigin)
)
: new Color( thisB.getConf('style.clip_marker_color', arguments ) ) || ( n > 1 ? white : black );
: new Color( thisB.getConf('style.clip_marker_color', confArgs ) ) || ( n > 1 ? white : black );
};
})();

Expand Down
13 changes: 7 additions & 6 deletions src/JBrowse/View/Track/Wiggle/XYPlot.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,32 +93,33 @@ var XYPlot = declare( [WiggleBase, YScaleMixin],
fRect.t = toY( score );
//console.log( score, fRect.t );

var confArgs = [f, this]; //< args passed to getConf calls

// draw the background color if we are configured to do so
if( fRect.t >= 0 ) {
var bgColor = this.getConf('style.bg_color',[f]);
var bgColor = this.getConf('style.bg_color', confArgs);
if( bgColor ) {
context.fillStyle = bgColor;
context.fillRect( fRect.l, 0, fRect.w, canvasHeight );
}
}

if( fRect.t <= canvasHeight ) { // if the rectangle is visible at all

if( fRect.t <= originY ) {
// bar goes upward
context.fillStyle = this.getConf('style.pos_color',[f]);
context.fillStyle = this.getConf('style.pos_color',confArgs);
context.fillRect( fRect.l, fRect.t, fRect.w, originY-fRect.t+1);
if( !disableClipMarkers && fRect.t < 0 ) { // draw clip marker if necessary
context.fillStyle = this.getConf('style.clip_marker_color',[f]) || this.getConf('style.neg_color',[f]);
context.fillStyle = this.getConf('style.clip_marker_color',confArgs) || this.getConf('style.neg_color',confArgs);
context.fillRect( fRect.l, 0, fRect.w, 2 );
}
}
else {
// bar goes downward
context.fillStyle = this.getConf('style.neg_color',[f]);
context.fillStyle = this.getConf('style.neg_color',confArgs);
context.fillRect( fRect.l, originY, fRect.w, fRect.t-originY+1 );
if( !disableClipMarkers && fRect.t >= canvasHeight ) { // draw clip marker if necessary
context.fillStyle = this.getConf('style.clip_marker_color',[f]) || this.getConf('style.pos_color',[f]);
context.fillStyle = this.getConf('style.clip_marker_color',confArgs) || this.getConf('style.pos_color',confArgs);
context.fillRect( fRect.l, canvasHeight-3, fRect.w, 2 );
}
}
Expand Down

0 comments on commit 124be57

Please sign in to comment.