fix: 连线边缘到边缘防穿模+箭头像素级贴合分支卡片边缘
This commit is contained in:
@ -145,6 +145,7 @@ export default {
|
|||||||
// ============================================================
|
// ============================================================
|
||||||
// 🚀 连线计算:中央 → 分支
|
// 🚀 连线计算:中央 → 分支
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
// 🔧 连线:卡片边缘到边缘,杜绝穿模
|
||||||
lines() {
|
lines() {
|
||||||
const result = [];
|
const result = [];
|
||||||
const flatMap = {};
|
const flatMap = {};
|
||||||
@ -153,14 +154,18 @@ export default {
|
|||||||
if (n._isMain) return;
|
if (n._isMain) return;
|
||||||
const parent = n.parent_task_id ? flatMap[n.parent_task_id] : null;
|
const parent = n.parent_task_id ? flatMap[n.parent_task_id] : null;
|
||||||
if (!parent) return;
|
if (!parent) return;
|
||||||
const px = parent.x + 160; // 卡片右边缘
|
const isLeft = n.x < parent.x;
|
||||||
const py = parent.y + 40; // 卡片垂直中心
|
const startX = isLeft ? n.x + 160 : parent.x + 160; // 左分支右边缘 / 主干右边缘
|
||||||
const nx = n.x; // 分支卡片左边缘
|
const endX = isLeft ? parent.x : n.x; // 主干左边缘 / 右分支左边缘
|
||||||
const ny = n.y + 40;
|
result.push({
|
||||||
result.push({ x1: Math.min(px, nx), y1: py, x2: Math.max(px, nx), y2: py, dashed: parent.status === 'COMPLETED' || parent.status === 'ARCHIVED' });
|
x1: startX, y1: parent.y + 40,
|
||||||
|
x2: endX, y2: parent.y + 40,
|
||||||
|
dashed: parent.status === 'COMPLETED' || parent.status === 'ARCHIVED',
|
||||||
|
});
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
// 🔧 箭头:像素级贴合分支卡片边缘
|
||||||
arrows() {
|
arrows() {
|
||||||
const result = [];
|
const result = [];
|
||||||
const flatMap = {};
|
const flatMap = {};
|
||||||
@ -172,8 +177,8 @@ export default {
|
|||||||
const isLegacy = parent && (parent.status === 'COMPLETED' || parent.status === 'ARCHIVED');
|
const isLegacy = parent && (parent.status === 'COMPLETED' || parent.status === 'ARCHIVED');
|
||||||
const isLeft = n.x < parent.x;
|
const isLeft = n.x < parent.x;
|
||||||
result.push({
|
result.push({
|
||||||
x: isLeft ? n.x + 165 : n.x - 12,
|
x: isLeft ? n.x + 160 : n.x - 6, // 左分支: 卡片右边缘; 右分支: 卡片左边缘-箭头宽度
|
||||||
y: n.y + 36,
|
y: n.y + 40 - 2, // 垂直居中 (border 4+4=8, -2 微调)
|
||||||
rot: isLeft ? 180 : 0,
|
rot: isLeft ? 180 : 0,
|
||||||
dashed: isLegacy,
|
dashed: isLegacy,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user