Skip to content

Commit

Permalink
Add outron rendering in NeatCanvasFeatures and NeatHTMLFeatures. Issue
Browse files Browse the repository at this point in the history
  • Loading branch information
enuggetry committed Feb 16, 2018
1 parent fb6a7aa commit 15e819e
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion plugins/NeatHTMLFeatures/js/main.js
Expand Up @@ -103,7 +103,7 @@ return declare( JBrowsePlugin,
},
insertIntrons: function(featureNode) {

var intronCount = 0;
var intronCount = 0;

// ignore if we have already processed this node
if (! dojo.hasClass(featureNode,"has-neat-introns")) {
Expand Down Expand Up @@ -158,6 +158,9 @@ return declare( JBrowsePlugin,
subNodes.sort(function(a, b){ return a.left - b.left; });
}

// insert outrons
this.insertOutrons(featureNode,subNodes);

// insert introns between subfeature gaps
for(var i=0; i< subNodes.length-1;++i) {
var gap = subNodes[i+1].left-(subNodes[i].left+subNodes[i].width);
Expand Down Expand Up @@ -200,6 +203,35 @@ return declare( JBrowsePlugin,
}
}
},
insertOutrons: function(featureNode,subNodes) {
// insert the outrons
var height = "100%";

var x1 = 0; //subNodes[0];
var w1 = subNodes[0].left; //fRect.rect.l;

if (w1 > 1) {
var str = "";
str += "<svg class='jb-intron' viewBox='0 0 100 100' preserveAspectRatio='none' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' ";
str += "style='position:absolute;z-index: 15;"; // this must be here and not in CSS file
str += "left: "+x1+"px;width: "+w1+"px;height: "+height+"'>";
str += "<polyline class='neat-intron' points='0,50 100,50' shape-rendering='optimizeQuality' />";
str += "</svg>";
domConstruct.place(str, featureNode);
}

var x2 = subNodes[subNodes.length-1].left + subNodes[subNodes.length-1].width;
var w2 = featureNode.offsetWidth - x2;

if (w2 > 1) {
str += "<svg class='jb-intron' viewBox='0 0 100 100' preserveAspectRatio='none' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' ";
str += "style='position:absolute;z-index: 15;"; // this must be here and not in CSS file
str += "left: "+x2+"px;width: "+w2+"px;height: "+height+"'>";
str += "<polyline class='neat-intron' points='0,50 100,50' shape-rendering='optimizeQuality' />";
str += "</svg>";
domConstruct.place(str, featureNode);
}
},
/*
* Paint neat features and subfeatures
*/
Expand Down

0 comments on commit 15e819e

Please sign in to comment.