Skip to content

Commit 5c89a81

Browse files
committed
bug fixes in condensing inline-reverse visualization
1 parent 20b119a commit 5c89a81

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

src/main/resources/static/js/knox.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,14 @@ export function condenseVisualization(graph){
121121
}
122122

123123
// check orientation
124-
if(dupLink1.orientation !== "NONE" && dupLink2.orientation !== "NONE"
125-
&& dupLink2.orientation !== dupLink1.orientation){
124+
if(dupLink1.orientation === "INLINE"){
126125
dupLink1.hasReverseOrient = true;
127126
dupLink2.hasReverseOrient = true;
128127
dupLink2.show = false;
128+
} else {
129+
dupLink1.hasReverseOrient = true;
130+
dupLink2.hasReverseOrient = true;
131+
dupLink1.show = false;
129132
}
130133
}
131134

@@ -136,9 +139,12 @@ export function condenseVisualization(graph){
136139
dupLink2.optional = true;
137140
dupLink1.show = false;
138141
}
142+
143+
if(dupLink1.orientation === 'NONE'){
144+
sourceTargetMap[stPairNum] = i; //save new index
145+
}
139146
}
140147
}
141-
142148
}
143149

144150
// Utility for disabling navigation features.

src/main/resources/static/js/target.js

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export default class Target{
3434

3535
setGraph(graph) {
3636
condenseVisualization(graph);
37-
console.log(graph);
3837

3938
var zoom = d3.behavior.zoom()
4039
.scaleExtent([1, 10])
@@ -104,7 +103,12 @@ export default class Target{
104103
let images = linksEnter.append("svg:image")
105104
.attr("height", sbolImgSize)
106105
.attr("width", sbolImgSize)
107-
.attr("class", "sboltip")
106+
.attr("class", (d) => {
107+
if (d.hasOwnProperty("componentRoles") && d["componentRoles"].length > 0) {
108+
return "sboltip";
109+
}
110+
return null;
111+
})
108112
.attr("title", (d) => {
109113
if (d.hasOwnProperty("componentIDs")) {
110114
let titleStr = "";
@@ -120,29 +124,22 @@ export default class Target{
120124
}
121125
})
122126
.attr("href", (d) => {
123-
if (d.hasOwnProperty("componentRoles")) {
124-
if (d["componentRoles"].length > 0) {
125-
return getSBOLImage(d["componentRoles"][0]);
126-
}
127+
if (d.hasOwnProperty("componentRoles") && d["componentRoles"].length > 0) {
128+
return getSBOLImage(d["componentRoles"][0]);
127129
}
128-
return "";
130+
return null;
129131
});
130132

131-
// Add images for inline & reverse complements
132-
let linksEnter2 = svg.selectAll(".link")
133-
.data(graph.links.filter(link => link.hasReverseOrient))
134-
.enter();
135-
136-
let reverseImgs = linksEnter2.append("svg:image")
133+
let reverseImgs = linksEnter.append("svg:image")
137134
.attr("height", sbolImgSize)
138135
.attr("width", sbolImgSize)
139136
.attr("href", (d) => {
140137
if (d.hasOwnProperty("componentRoles")) {
141-
if (d["componentRoles"].length > 0) {
138+
if (d["componentRoles"].length > 0 && d.hasReverseOrient) {
142139
return getSBOLImage(d["componentRoles"][0]);
143140
}
144141
}
145-
return "";
142+
return null;
146143
});
147144

148145
//place tooltip on the SVG images

0 commit comments

Comments
 (0)