Skip to content

Commit 3be2fdb

Browse files
authored
fix the node size and border colour (#9)
1 parent 36242be commit 3be2fdb

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

src/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export var DEFAULT_CONFIG = {
2525
gridSize: 10
2626
},
2727
node: {
28-
fill: '#293538',
28+
fill: '#2c393c',
2929
fillSecondary: '#364346',
3030
stroke: '#293538',
3131
strokeSelected: '#F60',

src/graph-view-node.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ class GraphViewNode {
3434
var portHeight = 0;
3535
var attributeHeight = 0;
3636
if (nodeSchema.inPorts) {
37-
portHeight = (nodeSchema.inPorts.length * 25) + 12;
37+
portHeight = (nodeSchema.inPorts.length * 25) + 10;
3838
}
3939
if (nodeSchema.outPorts) {
40-
var outHeight = (nodeSchema.outPorts.length * 25) + 12;
40+
var outHeight = (nodeSchema.outPorts.length * 25) + 10;
4141
if (outHeight > portHeight) portHeight = outHeight;
4242
}
43-
if (nodeSchema.attributes) {
43+
if (nodeSchema.attributes && nodeSchema.attributes.length > 0) {
4444
attributeHeight = nodeSchema.attributes.length * 32 + 10;
4545
}
4646
var rectSize = { x: 226, y: rectHeight + portHeight + attributeHeight };
@@ -62,10 +62,17 @@ class GraphViewNode {
6262
},
6363
labelBackground: {
6464
fill: this.getSchemaValue('fill'),
65-
refX: 1,
66-
refY: 1,
65+
refX: 2,
66+
refY: 2,
67+
width: rectSize.x - 4,
68+
height: rectHeight - 4
69+
},
70+
labelSeparator: {
71+
fill: this.getSchemaValue('stroke'),
6772
width: rectSize.x - 2,
68-
height: rectHeight - 2
73+
height: this.getSchemaValue('inPorts') || this.getSchemaValue('outPorts') ? 2 : 0,
74+
refX: 1,
75+
refY: rectHeight - 1
6976
},
7077
inBackground: {
7178
fill: this.getSchemaValue('fillSecondary'),

src/joint-shape-node.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ const jointShapeElement = () => joint.shapes.standard.Rectangle.extend({
1515
}, {
1616
tagName: 'rect',
1717
selector: 'labelBackground'
18+
}, {
19+
tagName: 'rect',
20+
selector: 'labelSeparator'
1821
}, {
1922
tagName: 'rect',
2023
selector: 'inBackground'

0 commit comments

Comments
 (0)