| | |
| | | const { node } = this.state |
| | | |
| | | if (node.shape === 'edge') { |
| | | let labels = this.selectNode.prop('labels') |
| | | if (!labels || labels.length === 0) { |
| | | labels = [{ |
| | | attrs: {label: { text: '' }} |
| | | }] |
| | | } |
| | | |
| | | if (key === 'title') { |
| | | this.selectNode.setLabels(value) |
| | | labels = JSON.parse(JSON.stringify(labels)) |
| | | labels[0].attrs.label.text = value |
| | | this.selectNode.setLabels(labels) |
| | | } else if (key === 'stroke') { |
| | | this.selectNode.attr('line/stroke', value) |
| | | } else if (key === 'strokeWidth') { |
| | | this.selectNode.attr('line/strokeWidth', value) |
| | | } else if (key === 'fontSize') { |
| | | labels = JSON.parse(JSON.stringify(labels)) |
| | | labels[0].attrs.label.fontSize = value |
| | | this.selectNode.setLabels(labels) |
| | | } else if (key === 'fontFill') { |
| | | labels = JSON.parse(JSON.stringify(labels)) |
| | | labels[0].attrs.label.fill = value |
| | | this.selectNode.setLabels(labels) |
| | | } else if (key === 'lineType') { |
| | | if (value === 'dash') { |
| | | this.selectNode.attr('line/strokeDasharray', 5) |
| | |
| | | lineType = 'dash' |
| | | } |
| | | |
| | | let font = node.labels && node.labels[0] ? node.labels[0].attrs.label : {} |
| | | |
| | | return [ |
| | | { |
| | | type: 'title', |
| | |
| | | type: 'text', |
| | | field: 'title', |
| | | label: '标签', |
| | | initval: title |
| | | initval: font.text || '' |
| | | }, |
| | | { |
| | | type: 'title', |
| | |
| | | {value: 'solid', text: '实线'}, |
| | | {value: 'dash', text: '虚线'} |
| | | ] |
| | | }, |
| | | { |
| | | type: 'title', |
| | | label: '标签样式' |
| | | }, |
| | | { |
| | | type: 'number', |
| | | field: 'fontSize', |
| | | label: '字号', |
| | | initval: font.fontSize || 14 |
| | | }, |
| | | { |
| | | type: 'color', |
| | | field: 'fontFill', |
| | | label: '颜色', |
| | | initval: font.fill || '#000000' |
| | | } |
| | | ] |
| | | } else if (node.shape === 'lane') { |