Skip to content

Commit

Permalink
Arrow on one side of feature
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Nov 18, 2018
1 parent 98850ef commit 602f213
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/JBrowse/View/FeatureGlyph/Alignment.js
Expand Up @@ -94,6 +94,7 @@ return declare( [BoxGlyph,MismatchesMixin], {
border_color: null,

strandArrow: false,
strandInlay: true,

height: 7,
marginBottom: 1,
Expand Down
19 changes: 19 additions & 0 deletions src/JBrowse/View/FeatureGlyph/Box.js
Expand Up @@ -35,6 +35,7 @@ return declare([ FeatureGlyph, FeatureLabelMixin], {
borderWidth: 0.5,
height: 11,
marginBottom: 2,
strandInlay: false,

strandArrow: true,

Expand Down Expand Up @@ -216,6 +217,24 @@ return declare([ FeatureGlyph, FeatureLabelMixin], {
if( bgcolor ) {
context.fillStyle = bgcolor;
context.fillRect( left, top, Math.max(1,width), height );
if(this.config.style.strandInlay && width > 1) {
var arrowWidth = 8
if(feature.get('strand') === 1) {
context.beginPath();
context.moveTo(left+width, top)
context.lineTo(left+width+arrowWidth, top+height/2)
context.lineTo(left+width, top+height)
context.closePath()
context.fill()
} else if(feature.get('strand') === -1) {
context.beginPath();
context.moveTo(left, top)
context.lineTo(left-arrowWidth, top+height/2)
context.lineTo(left, top+height)
context.closePath()
context.fill()
}
}
}
else {
context.clearRect( left, top, Math.max(1,width), height );
Expand Down

0 comments on commit 602f213

Please sign in to comment.