Commit 27f28e57 authored by Jean-Clement Gallardo's avatar Jean-Clement Gallardo
Browse files

ehance flux path two values

parent b294986e
...@@ -939,22 +939,54 @@ metExploreD3.GraphFlux = { ...@@ -939,22 +939,54 @@ metExploreD3.GraphFlux = {
} }
// 3rd case: The end node is not on the correct side of the reaction // 3rd case: The end node is not on the correct side of the reaction
else { else {
if (firstPointX < startX){ if (endY < startY){
lastPointX = endX - (metaboliteStyle.getWidth() / 2) + ((fluxValue * 0.01)); if (firstPointX < startX){
beforeLastPointX = lastPointX - 5; lastPointX = endX - (metaboliteStyle.getWidth() / 2);
beforeLastPointY = beforeLastPointY - (shiftValue*2); beforeLastPointX = lastPointX - 5;
lastPointY = lastPointY - (shiftValue*2); beforeLastPointY = beforeLastPointY - (shiftValue*2);
lastPointY = lastPointY - (shiftValue*2);
controlX = controlX - shiftValue;
controlY = controlY - shiftValue;
var control2X = controlX - shiftValue;
var control2Y = endY - shiftValue;
}
else {
lastPointX = endX + (metaboliteStyle.getWidth() / 2);
beforeLastPointX = lastPointX + 5;
beforeLastPointY = beforeLastPointY - (shiftValue*2);
lastPointY = lastPointY - (shiftValue*2);
controlX = controlX + shiftValue;
controlY = controlY - shiftValue;
var control2X = controlX + shiftValue;
var control2Y = endY - shiftValue;
}
} }
else { else {
lastPointX = endX + (metaboliteStyle.getWidth() / 2) - ((fluxValue * 0.01)); if (firstPointX < startX){
beforeLastPointX = lastPointX + 5; lastPointX = endX - (metaboliteStyle.getWidth() / 2);
beforeLastPointY = beforeLastPointY - (shiftValue*2); beforeLastPointX = lastPointX - 5;
lastPointY = lastPointY - (shiftValue*2); beforeLastPointY = beforeLastPointY - (shiftValue*2);
} lastPointY = lastPointY - (shiftValue*2);
controlX = controlX + shiftValue;
var control2X = controlX + shiftValue; controlX = controlX + shiftValue;
var control2Y = endY - shiftValue; controlY = controlY - shiftValue;
controlY = controlY - shiftValue; var control2X = controlX + shiftValue;
var control2Y = endY - shiftValue;
}
else {
lastPointX = endX + (metaboliteStyle.getWidth() / 2);
beforeLastPointX = lastPointX + 5;
beforeLastPointY = beforeLastPointY - (shiftValue*2);
lastPointY = lastPointY - (shiftValue*2);
controlX = controlX - shiftValue;
controlY = controlY - shiftValue;
var control2X = controlX - shiftValue;
var control2Y = endY - shiftValue;
}
}
var y1 = beforeLastPointY + 2; var y1 = beforeLastPointY + 2;
var y2 = beforeLastPointY - 2; var y2 = beforeLastPointY - 2;
var yMo = (lastPointY + beforeLastPointY)/2 var yMo = (lastPointY + beforeLastPointY)/2
...@@ -1064,22 +1096,52 @@ metExploreD3.GraphFlux = { ...@@ -1064,22 +1096,52 @@ metExploreD3.GraphFlux = {
} }
// 3rd case: The end node is not on the correct side of the reaction // 3rd case: The end node is not on the correct side of the reaction
else { else {
if (firstPointY < startY){ if (endX < startX){
lastPointY = endY - (metaboliteStyle.getWidth() / 2) + ((fluxValue * 0.01)); if (firstPointY < startY){
beforeLastPointY = lastPointY - 5; lastPointY = endY - (metaboliteStyle.getWidth() / 2);
beforeLastPointX = beforeLastPointX - (shiftValue*2); beforeLastPointY = lastPointY + 5;
lastPointX = lastPointX - (shiftValue*2); beforeLastPointX = beforeLastPointX - (shiftValue*2);
lastPointX = lastPointX - (shiftValue*2);
controlX = controlX - shiftValue;
controlY = controlY - shiftValue;
var control2X = endX - shiftValue;
var control2Y = controlY - shiftValue;
}
else {
lastPointY = endY + (metaboliteStyle.getWidth() / 2);
beforeLastPointY = lastPointY + 5;
beforeLastPointX = beforeLastPointX - (shiftValue*2);
lastPointX = lastPointX - (shiftValue*2);
controlX = controlX - shiftValue;
controlY = controlY + shiftValue;
var control2X = endX - shiftValue;
var control2Y = controlY + shiftValue;
}
}
if (endX > startX){
if (firstPointY < startY){
lastPointY = endY - (metaboliteStyle.getWidth() / 2);
beforeLastPointY = lastPointY - 5;
beforeLastPointX = beforeLastPointX - (shiftValue*2);
lastPointX = lastPointX - (shiftValue*2);
controlX = controlX - shiftValue;
controlY = controlY + shiftValue;
var control2X = endX - shiftValue;
var control2Y = controlY + shiftValue;
}
else {
lastPointY = endY + (metaboliteStyle.getWidth() / 2);
beforeLastPointY = lastPointY - 5;
beforeLastPointX = beforeLastPointX - (shiftValue*2);
lastPointX = lastPointX - (shiftValue*2);
controlX = controlX - shiftValue;
controlY = controlY - shiftValue;
var control2X = endX - shiftValue;
var control2Y = controlY - shiftValue;
}
} }
else {
lastPointY = endY + (metaboliteStyle.getWidth() / 2) - ((fluxValue * 0.01));
beforeLastPointY = lastPointY + 5;
beforeLastPointX = beforeLastPointX - (shiftValue*2);
lastPointX = lastPointX - (shiftValue*2);
}
controlX = controlX - shiftValue;
controlY = controlY + shiftValue;
var control2X = endX - shiftValue;
var control2Y = controlY + shiftValue;
var x1 = beforeLastPointX - 2; var x1 = beforeLastPointX - 2;
var x2 = beforeLastPointX + 2; var x2 = beforeLastPointX + 2;
var xMo = (beforeLastPointX+lastPointX)/2; var xMo = (beforeLastPointX+lastPointX)/2;
...@@ -1485,22 +1547,52 @@ metExploreD3.GraphFlux = { ...@@ -1485,22 +1547,52 @@ metExploreD3.GraphFlux = {
} }
// 3rd case: The end node is not on the correct side of the reaction // 3rd case: The end node is not on the correct side of the reaction
else { else {
if (firstPointY < startY){ if (endX < startX){
lastPointY = endY - (metaboliteStyle.getWidth() / 2); if (firstPointY < startY){
beforeLastPointY = lastPointY - 5; lastPointY = endY - (metaboliteStyle.getWidth() / 2);
beforeLastPointX = beforeLastPointX - (shiftValue*2); beforeLastPointY = lastPointY + 5;
lastPointX = lastPointX - (shiftValue*2); beforeLastPointX = beforeLastPointX - (shiftValue*2);
lastPointX = lastPointX - (shiftValue*2);
controlX = controlX - shiftValue;
controlY = controlY - shiftValue;
var control2X = endX - shiftValue;
var control2Y = controlY - shiftValue;
}
else {
lastPointY = endY + (metaboliteStyle.getWidth() / 2);
beforeLastPointY = lastPointY + 5;
beforeLastPointX = beforeLastPointX - (shiftValue*2);
lastPointX = lastPointX - (shiftValue*2);
controlX = controlX - shiftValue;
controlY = controlY + shiftValue;
var control2X = endX - shiftValue;
var control2Y = controlY + shiftValue;
}
} }
else { if (endX > startX){
lastPointY = endY + (metaboliteStyle.getWidth() / 2); if (firstPointY < startY){
beforeLastPointY = lastPointY + 5; lastPointY = endY - (metaboliteStyle.getWidth() / 2);
beforeLastPointX = beforeLastPointX - (shiftValue*2); beforeLastPointY = lastPointY - 5;
lastPointX = lastPointX - (shiftValue*2); beforeLastPointX = beforeLastPointX - (shiftValue*2);
lastPointX = lastPointX - (shiftValue*2);
controlX = controlX - shiftValue;
controlY = controlY + shiftValue;
var control2X = endX - shiftValue;
var control2Y = controlY + shiftValue;
}
else {
lastPointY = endY + (metaboliteStyle.getWidth() / 2);
beforeLastPointY = lastPointY - 5;
beforeLastPointX = beforeLastPointX - (shiftValue*2);
lastPointX = lastPointX - (shiftValue*2);
controlX = controlX - shiftValue;
controlY = controlY - shiftValue;
var control2X = endX - shiftValue;
var control2Y = controlY - shiftValue;
}
} }
controlX = controlX - shiftValue;
controlY = controlY + shiftValue;
var control2X = endX - shiftValue;
var control2Y = controlY + shiftValue;
path = "M" + startX + "," + startY + path = "M" + startX + "," + startY +
"L" + firstPointX + "," + firstPointY + "L" + firstPointX + "," + firstPointY +
...@@ -1593,22 +1685,54 @@ metExploreD3.GraphFlux = { ...@@ -1593,22 +1685,54 @@ metExploreD3.GraphFlux = {
} }
// 3rd case: The end node is not on the correct side of the reaction // 3rd case: The end node is not on the correct side of the reaction
else { else {
if (firstPointX < startX){ if (endY < startY){
lastPointX = endX - (metaboliteStyle.getWidth() / 2); if (firstPointX < startX){
beforeLastPointX = lastPointX - 5; lastPointX = endX - (metaboliteStyle.getWidth() / 2);
beforeLastPointY = beforeLastPointY - (shiftValue*2); beforeLastPointX = lastPointX - 5;
lastPointY = lastPointY - (shiftValue*2); beforeLastPointY = beforeLastPointY - (shiftValue*2);
lastPointY = lastPointY - (shiftValue*2);
controlX = controlX - shiftValue;
controlY = controlY - shiftValue;
var control2X = controlX - shiftValue;
var control2Y = endY - shiftValue;
}
else {
lastPointX = endX + (metaboliteStyle.getWidth() / 2);
beforeLastPointX = lastPointX + 5;
beforeLastPointY = beforeLastPointY - (shiftValue*2);
lastPointY = lastPointY - (shiftValue*2);
controlX = controlX + shiftValue;
controlY = controlY - shiftValue;
var control2X = controlX + shiftValue;
var control2Y = endY - shiftValue;
}
} }
else { else {
lastPointX = endX + (metaboliteStyle.getWidth() / 2); if (firstPointX < startX){
beforeLastPointX = lastPointX + 5; lastPointX = endX - (metaboliteStyle.getWidth() / 2);
beforeLastPointY = beforeLastPointY - (shiftValue*2); beforeLastPointX = lastPointX - 5;
lastPointY = lastPointY - (shiftValue*2); beforeLastPointY = beforeLastPointY - (shiftValue*2);
} lastPointY = lastPointY - (shiftValue*2);
controlX = controlX + shiftValue;
var control2X = controlX + shiftValue; controlX = controlX + shiftValue;
var control2Y = endY - shiftValue; controlY = controlY - shiftValue;
controlY = controlY - shiftValue; var control2X = controlX + shiftValue;
var control2Y = endY - shiftValue;
}
else {
lastPointX = endX + (metaboliteStyle.getWidth() / 2);
beforeLastPointX = lastPointX + 5;
beforeLastPointY = beforeLastPointY - (shiftValue*2);
lastPointY = lastPointY - (shiftValue*2);
controlX = controlX - shiftValue;
controlY = controlY - shiftValue;
var control2X = controlX - shiftValue;
var control2Y = endY - shiftValue;
}
}
path = "M" + startX + "," + startY + path = "M" + startX + "," + startY +
"L" + firstPointX + "," + firstPointY + "L" + firstPointX + "," + firstPointY +
"C" + controlX + "," + controlY + "," + control2X + "," + control2Y + "," + beforeLastPointX + "," + beforeLastPointY + "C" + controlX + "," + controlY + "," + control2X + "," + control2Y + "," + beforeLastPointX + "," + beforeLastPointY +
......
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