feat: 前端增加图例
This commit is contained in:
@@ -11,8 +11,20 @@ export const NODE_COLOR_MAP: Record<string, { fill: string; stroke: string }> =
|
||||
// 默认节点颜色(当类型未匹配时)
|
||||
export const DEFAULT_NODE_COLORS = { fill: '#C6E5FF', stroke: '#5B8FF9' };
|
||||
|
||||
// 节点类型双语标签映射
|
||||
export const NODE_TYPE_LABELS: Record<string, { zh: string; en: string }> = {
|
||||
'概念': { zh: '概念', en: 'Concept' },
|
||||
'工具': { zh: '工具', en: 'Tool' },
|
||||
'应用': { zh: '应用', en: 'Application' },
|
||||
};
|
||||
|
||||
// 获取节点颜色配置
|
||||
export const getNodeColors = (node: Node): { fill: string; stroke: string } => {
|
||||
if (!node.type) return DEFAULT_NODE_COLORS;
|
||||
return NODE_COLOR_MAP[node.type] || DEFAULT_NODE_COLORS;
|
||||
};
|
||||
|
||||
// 获取节点双语标签
|
||||
export const getNodeLabels = (type: string): { zh: string; en: string } => {
|
||||
return NODE_TYPE_LABELS[type] || { zh: type, en: type };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user