feat(flow): 泳道拓宽计划(空泳道策略 + 多槽位泳道,三视图同步);发布 v1.3.4
- 空泳道策略(F2 文档设置 →「泳道」):动作全部移走的泳道可保留(默认,序号不变) 或自动移除;条形空行 / 圆周空环 / 流程空列与左侧栏占位行同步 - 泳道加宽(1–5 槽):双击条形视图左侧泳道编号 / 右键空白泳道 / 左侧栏「N 槽」徽标; 条形分子行(浅色虚线分隔)、圆周同色加宽环带 + 槽位虚线、流程图分子列且泳道带 随内容智能加宽;拖拽动作同时换道 + 换槽位;旧数据零迁移(row 语义改为槽位并自动钳制) - 流程图智能排开:同源同层扇出连线在空隙内均匀铺开;同层节点水平重叠自动推开 - 显示修复:画布左栏标题按真实行高排版(灰色副标题不再被换行标题压住, 持续换行到泳道高度不足);多槽位采用「槽位紧凑 + 泳道间拉开」的间隔 - 「时序创建和编辑」更名为「文档设置」(含对话框标题/帮助/文档);新增自动保存 (默认 10 分钟,可选 1/5/10/30 或关闭;写入文件并同步 .bak) - 授权临时冻结(kLicenseRequired=false):桌面版导出无需 .lic;关于页授权状态 「开放授权版本」、EDC 版权、开发者与交流群(邮箱 liuyu65@126.com、微信 online-goose) - 更新体验:直接升级到最新版本提示、下载过程保持屏幕常亮提示、 下载/上传统一限速 320KB/s(客户端限速 + 发布脚本 --limit-rate 320k) - docs/HELP.md 与帮助中心同步更新;新增 docs/ROADMAP.md 开发路线图 - flutter analyze 0 问题、40 项测试全过;演示截图更新(含泳道加宽与拥挤场景验证图)
This commit is contained in:
+84
-3
@@ -251,10 +251,10 @@ class Action {
|
||||
/// 动作颜色(ARGB)。
|
||||
final int color;
|
||||
|
||||
/// 条形视图中的行序(自上而下,从 0 开始)。
|
||||
/// 泳道内的槽位(0 起):泳道加宽(多槽位)后,同泳道的并列动作按槽位分行放置。
|
||||
///
|
||||
/// `-1` 表示“未指定”,此时由 [BarLayout] 按工位与起始角自动排序;
|
||||
/// 一旦用户上下拖拽过行,就写入显式行序,行位置不再随相位变化而跳动。
|
||||
/// `-1` 或超出范围的值在布局时会被钳制到有效槽位(1 槽泳道统一落在 0 槽),
|
||||
/// 因此旧数据(历史序号值)无需迁移即可正常显示。
|
||||
final int row;
|
||||
|
||||
/// 指向本动作的依赖集合(本动作作为后继)。
|
||||
@@ -785,6 +785,11 @@ class Project {
|
||||
required this.units,
|
||||
required this.viewState,
|
||||
this.phaseZones = PhaseZone.defaults,
|
||||
this.keepEmptyLanes = true,
|
||||
this.minLaneCount = 0,
|
||||
this.laneSlots = const <int, int>{},
|
||||
this.autoSaveEnabled = true,
|
||||
this.autoSaveMinutes = 10,
|
||||
});
|
||||
|
||||
/// 项目名称。
|
||||
@@ -811,6 +816,37 @@ class Project {
|
||||
/// 相位分区(命名角度区间),用于条形视图顶部工艺阶段标注。
|
||||
final List<PhaseZone> phaseZones;
|
||||
|
||||
/// 是否保留空泳道:动作全部移走后仍保留该泳道(行 / 环 / 列),序号不变。
|
||||
///
|
||||
/// 关闭时按动作实际使用的层号渲染(空泳道自动消失、序号顺延)。
|
||||
final bool keepEmptyLanes;
|
||||
|
||||
/// 保底泳道数:开启 [keepEmptyLanes] 时渲染至少这么多条泳道(0 = 自动)。
|
||||
final int minLaneCount;
|
||||
|
||||
/// 泳道槽位数:layer → 槽位数(1–5);无记录的泳道视为 1 槽。
|
||||
///
|
||||
/// 泳道加宽后,同一泳道内的动作可按 [Action.row](槽位)分成多条并排行,
|
||||
/// 实现“一个泳道容纳多个并列动作”。
|
||||
final Map<int, int> laneSlots;
|
||||
|
||||
/// 泳道 [lane] 的槽位数(1–5;未配置为 1)。
|
||||
int slotsOf(int lane) {
|
||||
final int n = laneSlots[lane] ?? 1;
|
||||
return n < 1 ? 1 : (n > 5 ? 5 : n);
|
||||
}
|
||||
|
||||
/// 是否有任何泳道被加宽(多槽位)。
|
||||
bool get hasMultiSlotLanes => laneSlots.values.any((int v) => v > 1);
|
||||
|
||||
/// 是否启用自动保存(定时把文档写入文件,默认启用)。
|
||||
final bool autoSaveEnabled;
|
||||
|
||||
/// 自动保存间隔(分钟,1–240,默认 10)。
|
||||
///
|
||||
/// 仅在文档已有保存路径(手动保存过一次)后生效;自动保存会同时更新 `.bak`。
|
||||
final int autoSaveMinutes;
|
||||
|
||||
/// 按 id 查找动作;[id] 为 null 或未找到时返回 null。
|
||||
Action? actionById(String? id) {
|
||||
if (id == null) return null;
|
||||
@@ -842,6 +878,27 @@ class Project {
|
||||
/// 同一泳道可容纳多个互不重叠的动作,对应一个物理执行器。
|
||||
int get laneCount => <int>{for (final Action a in actions) a.layer}.length;
|
||||
|
||||
/// 渲染用的泳道层号列表(升序):统一供条形 / 圆周 / 流程图与侧栏使用。
|
||||
///
|
||||
/// - [keepEmptyLanes] 为真:渲染 `0 .. max(minLaneCount, 最大层号 + 1) - 1`,
|
||||
/// 动作全部移走的泳道保留为空泳道(序号不变);
|
||||
/// - 否则按动作实际使用的层号渲染(空泳道自动消失、序号顺延)。
|
||||
List<int> get renderLanes {
|
||||
final Set<int> layers = <int>{for (final Action a in actions) a.layer};
|
||||
if (!keepEmptyLanes) {
|
||||
return layers.toList()..sort();
|
||||
}
|
||||
int maxLayer = -1;
|
||||
for (final int l in layers) {
|
||||
if (l > maxLayer) maxLayer = l;
|
||||
}
|
||||
final int n = minLaneCount > maxLayer + 1 ? minLaneCount : maxLayer + 1;
|
||||
return <int>[for (int i = 0; i < n; i++) i];
|
||||
}
|
||||
|
||||
/// 渲染的泳道数量(含保留的空泳道)。
|
||||
int get renderLaneCount => renderLanes.length;
|
||||
|
||||
/// 基于当前实例创建副本,未提供的参数保持原值。
|
||||
Project copyWith({
|
||||
String? name,
|
||||
@@ -852,6 +909,11 @@ class Project {
|
||||
UnitSettings? units,
|
||||
ViewState? viewState,
|
||||
List<PhaseZone>? phaseZones,
|
||||
bool? keepEmptyLanes,
|
||||
int? minLaneCount,
|
||||
Map<int, int>? laneSlots,
|
||||
bool? autoSaveEnabled,
|
||||
int? autoSaveMinutes,
|
||||
}) {
|
||||
return Project(
|
||||
name: name ?? this.name,
|
||||
@@ -862,6 +924,11 @@ class Project {
|
||||
units: units ?? this.units,
|
||||
viewState: viewState ?? this.viewState,
|
||||
phaseZones: phaseZones ?? this.phaseZones,
|
||||
keepEmptyLanes: keepEmptyLanes ?? this.keepEmptyLanes,
|
||||
minLaneCount: minLaneCount ?? this.minLaneCount,
|
||||
laneSlots: laneSlots ?? this.laneSlots,
|
||||
autoSaveEnabled: autoSaveEnabled ?? this.autoSaveEnabled,
|
||||
autoSaveMinutes: autoSaveMinutes ?? this.autoSaveMinutes,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -876,6 +943,13 @@ class Project {
|
||||
'actions': actions.map((Action a) => a.toJson()).toList(),
|
||||
'viewState': viewState.toJson(),
|
||||
'phaseZones': phaseZones.map((PhaseZone z) => z.toJson()).toList(),
|
||||
'keepEmptyLanes': keepEmptyLanes,
|
||||
'minLaneCount': minLaneCount,
|
||||
'laneSlots': <String, int>{
|
||||
for (final MapEntry<int, int> e in laneSlots.entries) '${e.key}': e.value,
|
||||
},
|
||||
'autoSaveEnabled': autoSaveEnabled,
|
||||
'autoSaveMinutes': autoSaveMinutes,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -903,6 +977,13 @@ class Project {
|
||||
phaseZones: pz.isEmpty
|
||||
? PhaseZone.defaults
|
||||
: pz.map((dynamic e) => PhaseZone.fromJson(e as Map<String, dynamic>)).toList(),
|
||||
keepEmptyLanes: p['keepEmptyLanes'] as bool? ?? true,
|
||||
minLaneCount: (p['minLaneCount'] as num?)?.toInt() ?? 0,
|
||||
laneSlots: ((p['laneSlots'] as Map<String, dynamic>?) ?? <String, dynamic>{})
|
||||
.map((String k, dynamic v) =>
|
||||
MapEntry<int, int>(int.tryParse(k) ?? 0, (v as num?)?.toInt() ?? 1)),
|
||||
autoSaveEnabled: p['autoSaveEnabled'] as bool? ?? true,
|
||||
autoSaveMinutes: (p['autoSaveMinutes'] as num?)?.toInt() ?? 10,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user