Skip to content

Commit 63bf5c8

Browse files
committed
Moved if condition and fixed protein logic
1 parent 348195b commit 63bf5c8

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

src/client/common/cy/events/show-tooltip.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,24 @@ const MetadataTip = require('../tooltips/');
44
const bindShowTooltip = (cy,showTooltipsOnEdges) => {
55
const selector= 'node'+(showTooltipsOnEdges ?',edge':'');
66
cy.on('showTooltip', selector, function (evt) {
7+
8+
79
const node = evt.target;
810

911
const data = node.data();
1012
const name = data.label;
1113
const cy = evt.cy;
1214

13-
//Create or get tooltip HTML object
14-
let html = node.scratch('_tooltip');
15-
if (!(html)) {
16-
html = new MetadataTip(name, data, node);
17-
node.scratch('_tooltip', html);
18-
}
19-
2015
//if the selection is a compartment, do not display a tooltip
21-
if(data.class !== "compartment")
16+
if(data.class !== "compartment"){
17+
//Create or get tooltip HTML object
18+
let html = node.scratch('_tooltip');
19+
if (!(html)) {
20+
html = new MetadataTip(name, data, node);
21+
node.scratch('_tooltip', html);
22+
}
2223
html.show(cy);
24+
}
2325
});
2426
};
2527

src/client/common/cy/tooltips/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@ class MetadataTip {
1515
this.name = name;
1616
this.data = data.parsedMetadata;
1717
//Add an extra piece of metadata for proteins
18-
if(data.class === "macromolecule")
19-
this.data.push(["Search Link",data.label]);
18+
if(data.class === "process"){
19+
for(let i in this.data){
20+
if(this.data[i][0]==="Display Name")
21+
this.data.push(["Search Link",this.data[i][1]]);
22+
}
23+
}else{
24+
this.data.push(["Search Link",this.name]);
25+
}
2026
this.cyElement = cyElement;
2127
this.db = config.databases;
2228
this.viewStatus = {};

0 commit comments

Comments
 (0)