Commit 7c1c2433 by 吴斌

update:为新加连接线添加默认 category

parent 02c8c765
......@@ -269,6 +269,18 @@ function addInspector(){
addProperty.value = false
}
function addListener(){
// 监听连线事件,为所有新添加的线默认加上 "Arrow" 类别
myDiagram.addDiagramListener("LinkDrawn", function(e:go.DiagramEvent) {
let link = e.subject;
let linkDataArray = myDiagram.model.linkDataArray
linkDataArray.forEach((item:any)=>{
if (item === link.data && !item.category){
myDiagram.model.set(item, "category", "Arrow")
}
})
});
}
function importData() {
myDiagram.model = go.Model.fromJson(
{ "class": "GraphLinksModel",
......@@ -353,6 +365,7 @@ onMounted(() => {
importData();
changeData();
animateFlow(myDiagram);
addListener();
})
</script>
......
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