Commit 5b6fb0fb authored by maxchaza's avatar maxchaza
Browse files

Merge branch 'hotfix/labels'

parents 2d878196 9d986db6
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
/** /**
* The version of the application. * The version of the application.
*/ */
"version": "3.0.11", "version": "3.0.12",
/** /**
* The relative path to the application's markup file (html, jsp, asp, etc.). * The relative path to the application's markup file (html, jsp, asp, etc.).
......
...@@ -18,8 +18,15 @@ Ext.define('metExploreViz.view.form.label.LabelController', { ...@@ -18,8 +18,15 @@ Ext.define('metExploreViz.view.form.label.LabelController', {
view.lookupReference('selectLabel').on({ view.lookupReference('selectLabel').on({
beforerender: function(c) { beforerender: function(c) {
var session = _metExploreViz.getSessionById('viz'); 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); view.lookupReference('selectLabel').setStore(metabKeys);
if(metabKeys.length>0) { if(metabKeys.length>0) {
......
...@@ -244,24 +244,27 @@ d3.selection.prototype.setLabelNodeText = function(style, label) { ...@@ -244,24 +244,27 @@ d3.selection.prototype.setLabelNodeText = function(style, label) {
name = name.split(' '); name = name.split(' ');
el.text(''); 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(label!=="hidden"){
if (d.labelFont.fontX) { for (var i = 0; i < name.length; i++) {
tspan var nameDOMFormat = $("<div/>").html(name[i]).text();
.attr('x', function () { var tspan = el.append('tspan').text(nameDOMFormat);
return d.labelFont.fontX;
}); 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);
}
else tspan.attr('x', 0);
if (i > 0){ if (i > 0){
tspan.attr('dy', style.getFontSize()); tspan.attr('dy', style.getFontSize());
}
} }
} }
}) })
......
...@@ -682,7 +682,22 @@ metExploreD3.GraphPanel = { ...@@ -682,7 +682,22 @@ metExploreD3.GraphPanel = {
var reactionStyle; var reactionStyle;
if(jsonParsed.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); metExploreD3.setReactionStyle(reactionStyle);
} }
......
...@@ -573,7 +573,7 @@ metExploreD3.GraphStyleEdition = { ...@@ -573,7 +573,7 @@ metExploreD3.GraphStyleEdition = {
if(biologicalType==="link") if(biologicalType==="link")
selection = d3.select("#viz").select("#D3viz").selectAll(".linkGroup"); selection = d3.select("#viz").select("#D3viz").selectAll(".linkGroup");
console.log(selection);
selection selection
.selectAll(target+":not(.bypassed"+attrType+attrName+biologicalType+")"+":not(.mapped"+attrType+attrName+biologicalType+")") .selectAll(target+":not(.bypassed"+attrType+attrName+biologicalType+")"+":not(.mapped"+attrType+attrName+biologicalType+")")
.setLabelNodeText(styleToUse, value); .setLabelNodeText(styleToUse, value);
......
...@@ -5,7 +5,21 @@ ...@@ -5,7 +5,21 @@
/** /**
* draw a Reaction * 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) if(backgroundColor)
this.backgroundColor = 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