1. highlight last edge. 2. padEnd() to left align capsule label

This commit is contained in:
Cindy Chang
2024-08-28 14:09:32 +08:00
parent f3b9f7cd41
commit 4b56130278
2 changed files with 18 additions and 56 deletions

View File

@@ -60,15 +60,19 @@ export default defineStore('useMapPathStore', {
curGraphNode = prevGraphNode.outgoers('node').filter(neighbor =>
neighbor.data('label') === curButton[listIndex][nodeIndex]
);
if(!curGraphNode) {
// curGraphNode = prevGraphNode.outgoers('node').filter(node =>
// node.data('label').toLocaleLowerCase() === 'end');
}
curEdge = prevGraphNode.edgesWith(curGraphNode);
}
}
this.insightWithPath[INSIGHTS_FIELDS_AND_LABELS[i][0]][listIndex].nodes.push(curGraphNode);
this.insightWithPath[INSIGHTS_FIELDS_AND_LABELS[i][0]][listIndex].edges.push(curEdge);
// 特殊狀況在for迴圈之外額外插入最後一條線段
if(nodeIndex === curButton[listIndex].length - 1){
const endNode = curGraphNode.outgoers('node').filter(neighbor =>
neighbor.data('label').toLocaleLowerCase() === 'end'
);
const lastEdge = curGraphNode.edgesWith(endNode);
this.insightWithPath[INSIGHTS_FIELDS_AND_LABELS[i][0]][listIndex].edges.push(lastEdge);
}
prevGraphNode = curGraphNode;
}
}