1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00
This commit is contained in:
sakazuki 2018-12-02 14:27:48 +09:00
parent 0950041d26
commit 6de8b33769
3 changed files with 17 additions and 17 deletions

View File

@ -105,7 +105,7 @@ RED.palette = (function() {
var labelElement = el.find(".palette_label"); var labelElement = el.find(".palette_label");
labelElement.html(lines).attr('dir', RED.text.bidi.resolveBaseTextDir(lines)); labelElement.html(lines).attr('dir', RED.text.bidi.resolveBaseTextDir(lines));
if (RED.view.virtical()) { if (RED.view.vertical()) {
el.find(".palette_port").css({top:(multiLineNodeHeight/2-5)+"px", left: "55px"}); el.find(".palette_port").css({top:(multiLineNodeHeight/2-5)+"px", left: "55px"});
el.find(".palette_port_output").css({top:(multiLineNodeHeight-5)+"px", right: "55px"}); el.find(".palette_port_output").css({top:(multiLineNodeHeight-5)+"px", right: "55px"});
el.find(".palette_port_input").css({top: "-5px"}); el.find(".palette_port_input").css({top: "-5px"});

View File

@ -121,7 +121,7 @@ RED.userSettings = (function() {
title: "menu.label.other", title: "menu.label.other",
options: [ options: [
{setting:"view-show-tips",oldSettings:"menu-menu-item-show-tips",label:"menu.label.showTips",toggle:true,default:true,onchange:"core:toggle-show-tips"}, {setting:"view-show-tips",oldSettings:"menu-menu-item-show-tips",label:"menu.label.showTips",toggle:true,default:true,onchange:"core:toggle-show-tips"},
{setting:"view-flow-virtical",label:"menu.label.view.flowVirtical",toggle:true,default:true,onchange:RED.view.virtical} {setting:"view-flow-vertical",label:"menu.label.view.flowVirtical",toggle:true,default:true,onchange:RED.view.vertical}
] ]
} }
]; ];

View File

@ -33,7 +33,7 @@ RED.view = (function() {
var gridSize = 20; var gridSize = 20;
var snapGrid = false; var snapGrid = false;
var virtical = false; var vertical = false;
var activeSpliceLink; var activeSpliceLink;
var spliceActive = false; var spliceActive = false;
@ -660,7 +660,7 @@ RED.view = (function() {
nn.changed = true; nn.changed = true;
nn.moved = true; nn.moved = true;
if (virtical) { if (vertical) {
nn.w = Math.max(node_width,(nn.outputs||0) * 15); nn.w = Math.max(node_width,(nn.outputs||0) * 15);
nn.h = node_height; nn.h = node_height;
}else{ }else{
@ -941,14 +941,14 @@ RED.view = (function() {
var drag_line = drag_lines[i]; var drag_line = drag_lines[i];
var numOutputs = (drag_line.portType === PORT_TYPE_OUTPUT)?(drag_line.node.outputs || 1):1; var numOutputs = (drag_line.portType === PORT_TYPE_OUTPUT)?(drag_line.node.outputs || 1):1;
var sourcePort = drag_line.port; var sourcePort = drag_line.port;
if (virtical) { if (vertical) {
var portX = -((numOutputs-1)/2)*13 +13*sourcePort; var portX = -((numOutputs-1)/2)*13 +13*sourcePort;
}else{ }else{
var portY = -((numOutputs-1)/2)*13 +13*sourcePort; var portY = -((numOutputs-1)/2)*13 +13*sourcePort;
} }
var sc = (drag_line.portType === PORT_TYPE_OUTPUT)?1:-1; var sc = (drag_line.portType === PORT_TYPE_OUTPUT)?1:-1;
if (virtical) { if (vertical) {
drag_line.el.attr("d",generateLinkPathV(drag_line.node.x+portX,drag_line.node.y,mousePos[0],mousePos[1],sc)); drag_line.el.attr("d",generateLinkPathV(drag_line.node.x+portX,drag_line.node.y,mousePos[0],mousePos[1],sc));
}else{ }else{
drag_line.el.attr("d",generateLinkPath(drag_line.node.x+sc*drag_line.node.w/2,drag_line.node.y+portY,mousePos[0],mousePos[1],sc)) drag_line.el.attr("d",generateLinkPath(drag_line.node.x+sc*drag_line.node.w/2,drag_line.node.y+portY,mousePos[0],mousePos[1],sc))
@ -2088,13 +2088,13 @@ RED.view = (function() {
if (isLink) { if (isLink) {
d.w = node_height; d.w = node_height;
} else { } else {
if (virtical) { if (vertical) {
d.w = Math.max(node_width,20*(Math.ceil((calculateTextWidth(l, "node_label", 50)+(d._def.inputs>0?7:0))/20)),(d.outputs||0) * 15 ); d.w = Math.max(node_width,20*(Math.ceil((calculateTextWidth(l, "node_label", 50)+(d._def.inputs>0?7:0))/20)),(d.outputs||0) * 15 );
}else{ }else{
d.w = Math.max(node_width,20*(Math.ceil((calculateTextWidth(l, "node_label", 50)+(d._def.inputs>0?7:0))/20)) ); d.w = Math.max(node_width,20*(Math.ceil((calculateTextWidth(l, "node_label", 50)+(d._def.inputs>0?7:0))/20)) );
} }
} }
if (virtical) { if (vertical) {
d.h = node_height; d.h = node_height;
}else{ }else{
d.h = Math.max(node_height,(d.outputs||0) * 15); d.h = Math.max(node_height,(d.outputs||0) * 15);
@ -2284,7 +2284,7 @@ RED.view = (function() {
if (!isLink && d.resize) { if (!isLink && d.resize) {
var l = RED.utils.getNodeLabel(d); var l = RED.utils.getNodeLabel(d);
var ow = d.w; var ow = d.w;
if (virtical) { if (vertical) {
d.w = Math.max(node_width,20*(Math.ceil((calculateTextWidth(l, "node_label", 50)+(d._def.inputs>0?7:0))/20)),(d.outputs||0) * 15 ); d.w = Math.max(node_width,20*(Math.ceil((calculateTextWidth(l, "node_label", 50)+(d._def.inputs>0?7:0))/20)),(d.outputs||0) * 15 );
d.h = node_height; d.h = node_height;
}else{ }else{
@ -2330,7 +2330,7 @@ RED.view = (function() {
} }
var numOutputs = d.outputs; var numOutputs = d.outputs;
if (virtical) { if (vertical) {
var x = (d.w/2)-((numOutputs-1)/2)*13; var x = (d.w/2)-((numOutputs-1)/2)*13;
}else{ }else{
var y = (d.h/2)-((numOutputs-1)/2)*13; var y = (d.h/2)-((numOutputs-1)/2)*13;
@ -2350,7 +2350,7 @@ RED.view = (function() {
d._ports.exit().remove(); d._ports.exit().remove();
if (d._ports) { if (d._ports) {
numOutputs = d.outputs || 1; numOutputs = d.outputs || 1;
if (virtical) { if (vertical) {
x = (d.w/2)-((numOutputs-1)/2)*13; x = (d.w/2)-((numOutputs-1)/2)*13;
var y = d.h - 5; var y = d.h - 5;
}else{ }else{
@ -2360,7 +2360,7 @@ RED.view = (function() {
d._ports.each(function(d,i) { d._ports.each(function(d,i) {
var port = d3.select(this); var port = d3.select(this);
//port.attr("y",(y+13*i)-5).attr("x",x); //port.attr("y",(y+13*i)-5).attr("x",x);
if (virtical) { if (vertical) {
port.attr("transform", function(d) { return "translate("+((x+13*i)-5)+","+ y +")";}); port.attr("transform", function(d) { return "translate("+((x+13*i)-5)+","+ y +")";});
}else{ }else{
port.attr("transform", function(d) { return "translate("+x+","+((y+13*i)-5)+")";}); port.attr("transform", function(d) { return "translate("+x+","+((y+13*i)-5)+")";});
@ -2427,7 +2427,7 @@ RED.view = (function() {
thisNode.selectAll(".port_input").each(function(d,i) { thisNode.selectAll(".port_input").each(function(d,i) {
var port = d3.select(this); var port = d3.select(this);
if (virtical) { if (vertical) {
port.attr("transform",function(d){return "translate("+((d.w/2)-5)+", -5)";}) port.attr("transform",function(d){return "translate("+((d.w/2)-5)+", -5)";})
}else{ }else{
port.attr("transform",function(d){return "translate(-5,"+((d.h/2)-5)+")";}) port.attr("transform",function(d){return "translate(-5,"+((d.h/2)-5)+")";})
@ -2567,7 +2567,7 @@ RED.view = (function() {
link.attr("d",function(d){ link.attr("d",function(d){
var numOutputs = d.source.outputs || 1; var numOutputs = d.source.outputs || 1;
var sourcePort = d.sourcePort || 0; var sourcePort = d.sourcePort || 0;
if (virtical) { if (vertical) {
var x = -((numOutputs-1)/2)*13 +13*sourcePort; var x = -((numOutputs-1)/2)*13 +13*sourcePort;
d.x1 = d.source.x+x; d.x1 = d.source.x+x;
d.y1 = d.source.y+d.source.h/2; d.y1 = d.source.y+d.source.h/2;
@ -2998,11 +2998,11 @@ RED.view = (function() {
updateGrid(); updateGrid();
} }
}, },
virtical: function(v) { vertical: function(v) {
if (v === undefined) { if (v === undefined) {
return virtical; return vertical;
} else { } else {
virtical = v; vertical = v;
RED.view.redraw(); RED.view.redraw();
} }
}, },