Skip to content

Commit 8f16664

Browse files
committed
Don't override stylesheet width with genomic data
#253 Improve stylesheet
1 parent 8622b17 commit 8f16664

File tree

4 files changed

+8
-36
lines changed

4 files changed

+8
-36
lines changed

packages/pathway-mapper/dist/index.es5.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/pathway-mapper/dist/index.es5.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/pathway-mapper/src/managers/GenomicDataOverlayManager.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,6 @@ export default class GenomicDataOverlayManager {
203203
.style()
204204
.selector('node[type="GENE"]')
205205
.style("text-margin-y", 0)
206-
.style("width", function(ele) {
207-
return 150;
208-
})
209206
.style("background-image", function(ele) {
210207
const dataURI = "data:image/svg+xml;utf8,";
211208
return dataURI;
@@ -529,13 +526,13 @@ export default class GenomicDataOverlayManager {
529526
return;
530527
}
531528

529+
this.cy.nodes('[type="GENE"]').forEach(node => {
530+
node.data('w', this.getRequiredWidthForGenomicData(genomicDataBoxCount));
531+
})
532+
532533
this.cy
533534
.style()
534535
.selector('node[type="GENE"]')
535-
// It used to change the width of nodes only locally
536-
.style("width", (ele) => {
537-
return this.getRequiredWidthForGenomicData(genomicDataBoxCount);
538-
})
539536
.style("text-margin-y", function(ele) {
540537
const nodeLabel = ele.data("name");
541538
// If there is no genomic data for this node return !

packages/pathway-mapper/src/utils/GraphStyleSheet.tsx

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,12 @@ module.exports = (function()
1010
'color': '#1e2829',
1111
'width': function (ele)
1212
{
13-
return nodeWFunc(ele);
13+
return ele.data('w') || 0;
1414
},
1515
'height': function (ele)
1616
{
17-
return nodeHFunc(ele);
17+
return ele.data('h') || 0;
1818
},
19-
// 'background-image-opacity': 1,
20-
// 'background-image': function (ele)
21-
// {
22-
// return backgroundImageHandler(ele);
23-
// },
2419
'background-color': 'white',
2520
'shape': function(ele)
2621
{
@@ -397,25 +392,5 @@ module.exports = (function()
397392
}
398393
};
399394

400-
var nodeWFunc = function( ele )
401-
{
402-
if (ele._private.data['w'])
403-
{
404-
return ele._private.data['w'];
405-
}
406-
else
407-
return 0;
408-
};
409-
410-
var nodeHFunc = function( ele )
411-
{
412-
if (ele._private.data['h'])
413-
{
414-
return ele._private.data['h'];
415-
}
416-
else
417-
return 0;
418-
};
419-
420395
return styleSheet;
421396
})();

0 commit comments

Comments
 (0)