Skip to content

Commit

Permalink
bug fixes in condensing inline-reverse visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
dany-fu committed May 29, 2019
1 parent 20b119a commit 5c89a81
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
12 changes: 9 additions & 3 deletions src/main/resources/static/js/knox.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,14 @@ export function condenseVisualization(graph){
}

// check orientation
if(dupLink1.orientation !== "NONE" && dupLink2.orientation !== "NONE"
&& dupLink2.orientation !== dupLink1.orientation){
if(dupLink1.orientation === "INLINE"){
dupLink1.hasReverseOrient = true;
dupLink2.hasReverseOrient = true;
dupLink2.show = false;
} else {
dupLink1.hasReverseOrient = true;
dupLink2.hasReverseOrient = true;
dupLink1.show = false;
}
}

Expand All @@ -136,9 +139,12 @@ export function condenseVisualization(graph){
dupLink2.optional = true;
dupLink1.show = false;
}

if(dupLink1.orientation === 'NONE'){
sourceTargetMap[stPairNum] = i; //save new index
}
}
}

}

// Utility for disabling navigation features.
Expand Down
27 changes: 12 additions & 15 deletions src/main/resources/static/js/target.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export default class Target{

setGraph(graph) {
condenseVisualization(graph);
console.log(graph);

var zoom = d3.behavior.zoom()
.scaleExtent([1, 10])
Expand Down Expand Up @@ -104,7 +103,12 @@ export default class Target{
let images = linksEnter.append("svg:image")
.attr("height", sbolImgSize)
.attr("width", sbolImgSize)
.attr("class", "sboltip")
.attr("class", (d) => {
if (d.hasOwnProperty("componentRoles") && d["componentRoles"].length > 0) {
return "sboltip";
}
return null;
})
.attr("title", (d) => {
if (d.hasOwnProperty("componentIDs")) {
let titleStr = "";
Expand All @@ -120,29 +124,22 @@ export default class Target{
}
})
.attr("href", (d) => {
if (d.hasOwnProperty("componentRoles")) {
if (d["componentRoles"].length > 0) {
return getSBOLImage(d["componentRoles"][0]);
}
if (d.hasOwnProperty("componentRoles") && d["componentRoles"].length > 0) {
return getSBOLImage(d["componentRoles"][0]);
}
return "";
return null;
});

// Add images for inline & reverse complements
let linksEnter2 = svg.selectAll(".link")
.data(graph.links.filter(link => link.hasReverseOrient))
.enter();

let reverseImgs = linksEnter2.append("svg:image")
let reverseImgs = linksEnter.append("svg:image")
.attr("height", sbolImgSize)
.attr("width", sbolImgSize)
.attr("href", (d) => {
if (d.hasOwnProperty("componentRoles")) {
if (d["componentRoles"].length > 0) {
if (d["componentRoles"].length > 0 && d.hasReverseOrient) {
return getSBOLImage(d["componentRoles"][0]);
}
}
return "";
return null;
});

//place tooltip on the SVG images
Expand Down

0 comments on commit 5c89a81

Please sign in to comment.