Skip to content

Commit 940c6a0

Browse files
'配置节点中心的连接图标'
1 parent aece39d commit 940c6a0

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

src/views/customToolbar/component/uploadData.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ import 'codemirror/addon/fold/foldcode'
8484
import 'codemirror/addon/fold/foldgutter'
8585
import 'codemirror/addon/fold/brace-fold'
8686
import 'codemirror/addon/fold/comment-fold'
87-
import X2JS from '../x2js'
87+
import X2JS from 'x2js'
8888
8989
export default {
9090
props: ['graphXml', 'isOutputXml'],
@@ -119,7 +119,7 @@ export default {
119119
// let xmljson = x2js.xml2js(newvalue) //xml2js方法,传入xml格式的数据,返回json对象
120120
//创建一个x2js对象进行转换
121121
var x2js = new X2JS();
122-
this.xml2json = x2js.xml_str2json(newvalue);
122+
this.xml2json = x2js.xml2js(newvalue);
123123
// this.currentNodeData = newvalue
124124
},
125125
immediate: true,

src/views/customToolbar/customToolbar.vue

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ const {
366366
mxConstants,
367367
mxImage,
368368
mxCellState,
369-
// mxConnectionHandler,
369+
mxConnectionHandler,
370370
mxCodec,
371371
mxRectangleShape,
372372
mxPoint,
@@ -654,7 +654,7 @@ export default {
654654
vertex.title = toolItem['title'];
655655
vertex.id = toolItem['id'] + '-' + toolItem['idSeed'];
656656
// 添加完节点后自动添加顺序图标
657-
// this.addPoint(vertex, toolItem['idSeed']);
657+
this.addPoint(vertex, toolItem['idSeed']);
658658
toolItem['idSeed']++;
659659
vertex['isGroup'] = toolItem['id'].includes('group') ? true : false
660660
} finally {
@@ -735,7 +735,7 @@ export default {
735735
this.graph.getModel().beginUpdate();
736736
try {
737737
let vertex = this.graph.insertVertex(parent, null, null, realX - (width / 2), realY - (height / 2), width, height, style + ';whiteSpace=wrap;word-break=break-all');
738-
vertex.title = `<div style='word-break:break-all'>`+toolItem['title']+'</div>';
738+
vertex.title = `<div style='word-break:break-all'>` + toolItem['title'] + '</div>';
739739
vertex.dropAble = toolItem['dropAble'];
740740
vertex.id = toolItem['id'] + '-' + toolItem['idSeed'];
741741
toolItem['idSeed']++;
@@ -1244,7 +1244,7 @@ export default {
12441244
// mxGraph.prototype.expandedImage = new mxImage('images/expanded.gif', 15, 15);
12451245
12461246
// 配置节点中心的连接图标(注釋掉即可指定錨點連接到另一個節點的錨點上)
1247-
// mxConnectionHandler.prototype.connectImage = new mxImage('./icon/connectionpoint.png', 14, 14);
1247+
mxConnectionHandler.prototype.connectImage = new mxImage('./icon/connectionpoint.png', 14, 14);
12481248
// 显示中心端口图标
12491249
graph.connectionHandler.targetConnectImage = false;
12501250
// 是否开启浮动自动连接
@@ -1656,29 +1656,29 @@ export default {
16561656
},
16571657
16581658
// 添加序号图标
1659-
// addPoint(cell, number) {
1660-
// const normalTypeVertex = this.graph.insertVertex(cell, null, null,
1661-
// 1, 1, 30, 30,
1662-
// `port;normalType;orderPoint=true;fillColor=none;image=./images/order/unselect-${number}.png;spacingLeft=18;spacingBottom=18`, true);
1663-
// // 固定序号图标的位置.不随节点变大而改变位置
1664-
// normalTypeVertex.geometry.offset = new mxPoint(-18, -18);
1665-
// // 序号图标无法连接
1666-
// normalTypeVertex.setConnectable(false);
1667-
// normalTypeVertex.id = (cell.id).split('-')[0] + `-unselect-${number}`;
1668-
// normalTypeVertex.value = number;
1669-
// normalTypeVertex.geometry.relative = true;
1670-
// // 将新增的图标鼠标悬浮换成手势的图案
1671-
// const oldGetCursorForCell = mxGraph.prototype.getCursorForCell;
1672-
// this.graph.getCursorForCell = function (...args) {
1673-
// const [cell] = args;
1674-
// if (cell.edge || cell.style == undefined) {
1675-
// return;
1676-
// }
1677-
// return cell.style.includes('normalType') ?
1678-
// 'pointer' :
1679-
// oldGetCursorForCell.apply(this, args);
1680-
// };
1681-
// },
1659+
addPoint (cell, number) {
1660+
const normalTypeVertex = this.graph.insertVertex(cell, null, null,
1661+
null, null, 30, 30,
1662+
`port;normalType;orderPoint=true;fillColor=none;image=./images/order/unselect-${number}.png;spacingLeft=-45px;spacingBottom=-45px`);
1663+
// 固定序号图标的位置.不随节点变大而改变位置
1664+
// normalTypeVertex.geometry.offset = new mxPoint(45, 45);
1665+
// 序号图标无法连接
1666+
// normalTypeVertex.setConnectable(false);
1667+
normalTypeVertex.id = (cell.id).split('-')[0] + `-unselect-${number}`;
1668+
normalTypeVertex.value = number;
1669+
normalTypeVertex.geometry.relative = true;
1670+
// 将新增的图标鼠标悬浮换成手势的图案
1671+
// const oldGetCursorForCell = mxGraph.prototype.getCursorForCell;
1672+
// this.graph.getCursorForCell = function (...args) {
1673+
// const [cell] = args;
1674+
// if (cell.edge || cell.style == undefined) {
1675+
// return;
1676+
// }
1677+
// return cell.style.includes('normalType') ?
1678+
// 'pointer' :
1679+
// oldGetCursorForCell.apply(this, args);
1680+
// };
1681+
},
16821682
16831683
// 加载案例流程图
16841684
loadFlowCase (index) {

0 commit comments

Comments
 (0)