v1.3.13: 模块化注册架构 + PDS流程设计套件更名 + 依赖/圆周交互修复

- 模块化:EdcModule 契约 + registry + 模块独立目录;发布包增加 modules/registry.json
- 更名:PDS流程设计套件 / ProcessDesignSuite;同步构建、发布脚本与文档
- 时序图:依赖偏移以时间显示/编辑;紧贴依赖隐藏箭头并在接缝显示标签;动作条磁吸
- 圆周:依赖标签沿圆弧方向、环间空隙;动作旋转磁吸增强;短弧标签优先动作名
- 清理:release 移至源码同级(本地不入库);tool 合并到 tools;发布说明迁移 docs/release-notes
This commit is contained in:
2026-11-22 10:02:48 +08:00
parent afc4dc6dd7
commit 0a3f2c5cc6
105 changed files with 6309 additions and 3577 deletions
+61
View File
@@ -0,0 +1,61 @@
/// 动作条拖拽吸附:把整体拖动的水平位移吸附到最近的动作条端点、整 5°、
/// 0/360 或相位分区边界。
///
/// 架构位置:布局层纯函数,不依赖 UI 状态;`CanvasView` 在整体拖动时调用,
/// 单元测试可直接验证吸附结果。
library;
import 'package:sequence_diagram/model/models.dart';
/// 计算整体拖动后的动作起始角。
///
/// - [project]:当前工程;
/// - [excludeId]:正在拖动的动作 id(不参与吸附,避免自吸附);
/// - [rawStart]:未吸附的起始角;
/// - [duration]:动作持续角(整体拖动不改变长度);
/// - [toleranceDeg]:吸附容差(度)。
///
/// 返回 `(吸附后的起始角, 参考角度)`;参考角度用于绘制竖向虚线,
/// 未吸附时为 null。
(double, double?) snapActionStart({
required Project project,
required String excludeId,
required double rawStart,
required double duration,
required double toleranceDeg,
}) {
final double tol = toleranceDeg <= 0 ? 0 : toleranceDeg;
final List<double> candidates = <double>[0, 360];
for (int d = 0; d <= 360; d += 5) {
candidates.add(d.toDouble());
}
for (final Action a in project.actions) {
if (a.id == excludeId) continue;
candidates.add(a.startAngle);
candidates.add(a.endAngle);
}
for (final PhaseZone z in project.phaseZones) {
candidates.add(z.startAngle);
candidates.add(z.endAngle);
}
final double end = rawStart + duration;
double best = rawStart;
double bestD = tol;
double? guide;
// 起点与终点同时参与匹配:取绝对调整量最小的一条候选。
for (final double cand in candidates) {
final double ds = (cand - rawStart).abs();
if (ds < bestD) {
bestD = ds;
best = cand;
guide = cand;
}
final double de = (cand - end).abs();
if (de < bestD) {
bestD = de;
best = cand - duration;
guide = cand;
}
}
return (best.clamp(0, 360 - duration), guide);
}