Commit 38545323 authored by maxchaza's avatar maxchaza

Remove unused labels & allows to hide

parent 2d878196
......@@ -18,8 +18,15 @@ Ext.define('metExploreViz.view.form.label.LabelController', {
view.lookupReference('selectLabel').on({
beforerender: function(c) {
var session = _metExploreViz.getSessionById('viz');
var metabKeys=Object.keys(session.getD3Data().getNodes().filter(n => n.getBiologicalType() === "metabolite")[0]);
var metabKeys;
metabKeys = Object.keys(session.getD3Data().getNodes().filter(n => n.getBiologicalType() === view.aStyleFormParent.biologicalType)[0]);
metabKeys = metabKeys.filter(function(key){
return key!=="isSideCompound" && key!=="reactionReversibility" && key!=="reactionReversibility" && key!=="selected" && key!=="duplicated" && key!=="labelVisible" &&
key!=="svg" && key!=="svgWidth" && key!=="svgHeight" && key!=="pathways" && key!=="compartment" && key!=="mappingDatas" &&
key!=="locked" && key!=="label" && key!=="labelFont" && key!=="index" && key!=="vy" && key!=="vx" && key!=="y" && key!=="x" && key!=="y";
});
view.lookupReference('selectLabel').setStore(metabKeys);
if(metabKeys.length>0) {
......
......@@ -244,24 +244,27 @@ d3.selection.prototype.setLabelNodeText = function(style, label) {
name = name.split(' ');
el.text('');
for (var i = 0; i < name.length; i++) {
var nameDOMFormat = $("<div/>").html(name[i]).text();
var tspan = el.append('tspan').text(nameDOMFormat);
if (d.labelFont){
if (d.labelFont.fontX) {
tspan
.attr('x', function () {
return d.labelFont.fontX;
});
if(label!=="hidden"){
for (var i = 0; i < name.length; i++) {
var nameDOMFormat = $("<div/>").html(name[i]).text();
var tspan = el.append('tspan').text(nameDOMFormat);
if (d.labelFont){
if (d.labelFont.fontX) {
tspan
.attr('x', function () {
return d.labelFont.fontX;
});
}
else tspan.attr('x', 0);
}
else tspan.attr('x', 0);
}
else tspan.attr('x', 0);
if (i > 0){
tspan.attr('dy', style.getFontSize());
if (i > 0){
tspan.attr('dy', style.getFontSize());
}
}
}
})
......
......@@ -682,7 +682,22 @@ metExploreD3.GraphPanel = {
var reactionStyle;
if(jsonParsed.reactionStyle)
{
var reactionStyle = new ReactionStyle(jsonParsed.reactionStyle.backgroundColor,jsonParsed.reactionStyle.height, jsonParsed.reactionStyle.width, jsonParsed.reactionStyle.rx, jsonParsed.reactionStyle.ry, jsonParsed.reactionStyle.opacity, jsonParsed.reactionStyle.strokeColor, jsonParsed.reactionStyle.strokeWidth, jsonParsed.reactionStyle.fontColor, jsonParsed.reactionStyle.fontSize, jsonParsed.reactionStyle.labelOpacity, jsonParsed.reactionStyle.label, jsonParsed.reactionStyle.useAlias);
var reactionStyle = new ReactionStyle(
jsonParsed.reactionStyle.backgroundColor,
jsonParsed.reactionStyle.height,
jsonParsed.reactionStyle.width,
jsonParsed.reactionStyle.rx,
jsonParsed.reactionStyle.ry,
jsonParsed.reactionStyle.opacity,
jsonParsed.reactionStyle.strokeColor,
jsonParsed.reactionStyle.strokeWidth,
jsonParsed.reactionStyle.fontColor,
jsonParsed.reactionStyle.fontSize,
jsonParsed.reactionStyle.fontWeight,
jsonParsed.reactionStyle.labelOpacity,
jsonParsed.reactionStyle.label,
jsonParsed.reactionStyle.useAlias);
metExploreD3.setReactionStyle(reactionStyle);
}
......
......@@ -573,7 +573,7 @@ metExploreD3.GraphStyleEdition = {
if(biologicalType==="link")
selection = d3.select("#viz").select("#D3viz").selectAll(".linkGroup");
console.log(selection);
selection
.selectAll(target+":not(.bypassed"+attrType+attrName+biologicalType+")"+":not(.mapped"+attrType+attrName+biologicalType+")")
.setLabelNodeText(styleToUse, value);
......
......@@ -5,7 +5,21 @@
/**
* draw a Reaction
*/
var ReactionStyle = function(backgroundColor, height, width, rx, ry, opacity, strokeColor, strokeWidth, fontColor, fontSize, fontWeight, labelOpacity, displayNodeName, useAlias){
var ReactionStyle = function(
backgroundColor,
height,
width,
rx,
ry,
opacity,
strokeColor,
strokeWidth,
fontColor,
fontSize,
fontWeight,
labelOpacity,
displayNodeName,
useAlias){
if(backgroundColor)
this.backgroundColor = backgroundColor;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment