feat(deps): 依赖连线自动错开 + 拖拽调整走线(三种视图);发布 v1.3.3

- 新增共享走线模块 lib/layout/dep_routes.dart:条形 / 圆周的走线、标签
  挂钩与外移判定、命中测试统一到同一份几何(绘制与命中不再各算一套);
- 自动错开:同一走线分组(同泳道 / 相邻泳道对 / 跨行对)内的多条依赖
  依次 ±6px 错开,解决“多条线完全重叠”;
- 手动走线偏移:Dependency.routeOffset(随工程保存)——
  · 条形 / 流程图:上下拖动平移横线,跨行走廊为左右拖动;
  · 圆周:沿半径方向(法线)拖动;
  · 直角拐点随平移保留,双击连线或右键「复位走线偏移」恢复自动位置;
  · 选中连线以强调色加粗高亮,状态栏给出操作提示;
- 画布命中判定改用「按下位置」(此前用手势验收点,细目标会抓空),
  端点把手与连线重叠时按“谁更近”判定优先级;
- 帮助中心补充「连线重叠怎么办」;版本号 1.3.3+19;
  更新说明 release/RELEASE_NOTES_v1.3.3.md。
This commit is contained in:
2026-10-09 21:27:40 +08:00
parent c352af2359
commit b902fa06c4
15 changed files with 920 additions and 233 deletions
+11 -4
View File
@@ -22,6 +22,7 @@ class FlowchartPainter extends CustomPainter {
required this.criticalActions,
required this.criticalDeps,
required this.selectedIds,
this.selectedDep,
});
/// 项目数据。
@@ -35,6 +36,9 @@ class FlowchartPainter extends CustomPainter {
/// 选中动作 id。
final Set<String> selectedIds;
/// 当前选中的依赖连线键(`from->to`);非空时该走线以强调色高亮。
final String? selectedDep;
@override
void paint(Canvas canvas, Size size) {
final FlowLayout layout = FlowLayout(
@@ -112,6 +116,9 @@ class FlowchartPainter extends CustomPainter {
final Color col = e.type == null
? tokens.sub
: (e.type == DepType.fs ? tokens.fs : tokens.ss);
// 选中的依赖连线以强调色加粗高亮(拖拽调整走线时可见)。
final bool sel = selectedDep == r.key;
final Color draw = sel ? tokens.accent : col;
final Path p = Path()..moveTo(r.points.first.dx, r.points.first.dy);
for (int i = 1; i < r.points.length; i++) {
p.lineTo(r.points[i].dx, r.points[i].dy);
@@ -129,16 +136,16 @@ class FlowchartPainter extends CustomPainter {
}
final Paint line = Paint()
..style = PaintingStyle.stroke
..strokeWidth = e.critical ? 1.8 : 1.2
..strokeWidth = sel ? 2.4 : (e.critical ? 1.8 : 1.2)
..strokeJoin = StrokeJoin.round
..strokeCap = StrokeCap.round
..color = col.withValues(alpha: e.type == null ? 0.7 : 0.95);
..color = sel ? draw : draw.withValues(alpha: e.type == null ? 0.7 : 0.95);
if (r.dashed) {
_dashPath(canvas, p, line);
} else {
canvas.drawPath(p, line);
}
_arrow(canvas, r.tip, r.dir, col);
_arrow(canvas, r.tip, r.dir, draw);
// FS / SS+偏移 标签
if (e.type != null) {
final String text = switch (e.type!) {
@@ -147,7 +154,7 @@ class FlowchartPainter extends CustomPainter {
DepType.ff => 'FF',
DepType.sf => 'SF',
};
_chip(canvas, r.labelAt, text, col);
_chip(canvas, r.labelAt, text, draw);
}
}
}