1.3.5:更名 EDC|易得设计,空白启动首页 + 可扩展图元库识别,架构图大版本
- 品牌:更名 EDC|易得设计(exe/安卓/仓库 EasyDesignCollection;旧地址 301 兼容老客户端更新) - 首页:空白启动 + 六模块「新建文档」选择 + 最近打开;品牌菜单重做 - 架构图:手绘识别统一图形;Visio 式可扩展图元库(导入 / 存为图元 / 分类折叠 / 手绘匹配 / 多笔回溯组合);识别后图形尺寸编辑(宽高长径 + 画布标注 + 双击改值); IT 系统图元;mm 标尺(右轴数值 / 实线游标 / A0 默认画布);图层、F8 正交 / F10 极轴、 对齐均布;连线端点换绑重吸附;DXF / SVG / PNG 导出;缩小时画布溢出到侧栏的裁剪修复 - 时序图:分文件保存(*.seq.json / *.arch.json;旧 .edc.json 兼容) - 路径:运行时目录迁移 %APPDATA%/EDC;素材库 library/;安卓 Documents/EDC - 清理:参数化草图入口冻结;Windows Ink 原生桥移除;dist/ 退役 - 构建:exe + APK 双端同步(1.3.5+26);发布脚本切换 release/ 新目录结构
This commit is contained in:
+53
-10
@@ -10,6 +10,8 @@ library;
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import '../arch/arch_models.dart';
|
||||
|
||||
/// 主视图模式。
|
||||
enum ViewMode {
|
||||
/// 条形(甘特式)节拍视图。
|
||||
@@ -22,6 +24,18 @@ enum ViewMode {
|
||||
flow,
|
||||
}
|
||||
|
||||
/// 顶层设计模块(左上角 logo「设计合集」菜单切换的对象)。
|
||||
enum AppMode {
|
||||
/// 首页(空白启动:新建 / 打开文档前的工作台)。
|
||||
home,
|
||||
|
||||
/// 时序图设计(条形 / 圆周 / 流程图)。
|
||||
sequence,
|
||||
|
||||
/// 架构图设计(手绘识别 / 系统架构)。
|
||||
architecture,
|
||||
}
|
||||
|
||||
/// 时间单位。
|
||||
enum TimeUnit {
|
||||
/// 毫秒。
|
||||
@@ -106,7 +120,7 @@ String colorToHex(int argb) {
|
||||
return '#${rgb.toRadixString(16).padLeft(6, '0')}';
|
||||
}
|
||||
|
||||
/// 将 `#rrggbb`(可带 `#`,大小写均可)解析为不透明的 ARGB 整数。
|
||||
/// 解析 `#rrggbb`(可带 `#`,大小写均可)为不透明的 ARGB 整数。
|
||||
///
|
||||
/// 参数 [hex]:十六进制颜色字符串。
|
||||
/// 返回:`0xFF000000 | rgb`;解析失败时回退到默认色 `0x4CC9F0`。
|
||||
@@ -116,6 +130,15 @@ int hexToColor(String hex) {
|
||||
return 0xFF000000 | (rgb & 0xFFFFFF);
|
||||
}
|
||||
|
||||
/// 组合颜色与可选透明度(旧文件无 `colorA` 时保持不透明)。
|
||||
///
|
||||
/// `#rrggbb` 格式本身不含透明度;当颜色的 alpha ≠ FF 时额外写 `colorA` 字段,
|
||||
/// 保证保存 / 重新打开后颜色完全一致。
|
||||
int withColorAlpha(int argb, Object? alpha) {
|
||||
if (alpha is! num) return argb;
|
||||
return ((alpha.toInt() & 0xFF) << 24) | (argb & 0xFFFFFF);
|
||||
}
|
||||
|
||||
/// 动作之间的时序依赖:由 [fromId] 指向 [toId],描述二者的开始/结束约束。
|
||||
///
|
||||
/// 依赖会被关键路径算法(见 AppController._recomputeCritical)用来计算
|
||||
@@ -293,7 +316,7 @@ class Action {
|
||||
);
|
||||
}
|
||||
|
||||
/// 序列化为 JSON;颜色以 `#rrggbb` 字符串保存,依赖递归序列化。
|
||||
/// 序列化为 JSON;颜色以 `#rrggbb` 字符串保存(半透明时另存 `colorA`),依赖递归序列化。
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'id': id,
|
||||
'name': name,
|
||||
@@ -303,6 +326,7 @@ class Action {
|
||||
'durationAngle': durationAngle,
|
||||
'layer': layer,
|
||||
'color': colorToHex(color),
|
||||
if (((color >> 24) & 0xFF) != 0xFF) 'colorA': (color >> 24) & 0xFF,
|
||||
'row': row,
|
||||
'deps': deps.map((Dependency d) => d.toJson()).toList(),
|
||||
};
|
||||
@@ -317,7 +341,8 @@ class Action {
|
||||
startAngle: (j['startAngle'] as num?)?.toDouble() ?? 0,
|
||||
durationAngle: (j['durationAngle'] as num?)?.toDouble() ?? 0,
|
||||
layer: (j['layer'] as num?)?.toInt() ?? 0,
|
||||
color: hexToColor(j['color'] as String? ?? '#4cc9f0'),
|
||||
color: withColorAlpha(
|
||||
hexToColor(j['color'] as String? ?? '#4cc9f0'), j['colorA']),
|
||||
row: (j['row'] as num?)?.toInt() ?? -1,
|
||||
deps: ((j['deps'] as List<dynamic>?) ?? <dynamic>[])
|
||||
.map((dynamic e) => Dependency.fromJson(e as Map<String, dynamic>))
|
||||
@@ -361,12 +386,13 @@ class Station {
|
||||
);
|
||||
}
|
||||
|
||||
/// 序列化为 JSON;颜色以 `#rrggbb` 字符串保存。
|
||||
/// 序列化为 JSON;颜色以 `#rrggbb` 字符串保存(半透明时另存 `colorA`)。
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
'id': id,
|
||||
'name': name,
|
||||
'order': order,
|
||||
'color': colorToHex(color),
|
||||
if (((color >> 24) & 0xFF) != 0xFF) 'colorA': (color >> 24) & 0xFF,
|
||||
};
|
||||
|
||||
/// 从 JSON 反序列化;缺失字段使用默认值。
|
||||
@@ -375,7 +401,8 @@ class Station {
|
||||
id: j['id'] as String? ?? 'ST1',
|
||||
name: j['name'] as String? ?? '工位',
|
||||
order: (j['order'] as num?)?.toInt() ?? 0,
|
||||
color: hexToColor(j['color'] as String? ?? '#4cc9f0'),
|
||||
color: withColorAlpha(
|
||||
hexToColor(j['color'] as String? ?? '#4cc9f0'), j['colorA']),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -778,7 +805,7 @@ class Project {
|
||||
/// [units]:单位设置;[viewState]:视图状态。
|
||||
const Project({
|
||||
required this.name,
|
||||
this.schema = 'seqdiagram/1.2',
|
||||
this.schema = 'edc/1.3',
|
||||
required this.cycle,
|
||||
required this.stations,
|
||||
required this.actions,
|
||||
@@ -790,6 +817,7 @@ class Project {
|
||||
this.laneSlots = const <int, int>{},
|
||||
this.autoSaveEnabled = true,
|
||||
this.autoSaveMinutes = 10,
|
||||
this.arch = ArchDoc.empty,
|
||||
});
|
||||
|
||||
/// 项目名称。
|
||||
@@ -847,6 +875,12 @@ class Project {
|
||||
/// 仅在文档已有保存路径(手动保存过一次)后生效;自动保存会同时更新 `.bak`。
|
||||
final int autoSaveMinutes;
|
||||
|
||||
/// 架构图文档(图形 / 墨迹 / 连线 + 视口)。
|
||||
///
|
||||
/// 与 [actions] 等时序数据同存于一个工程文件,但**暂不互通**:
|
||||
/// 架构图不引用工位 / 动作,也不参与节拍与关键路径计算。
|
||||
final ArchDoc arch;
|
||||
|
||||
/// 按 id 查找动作;[id] 为 null 或未找到时返回 null。
|
||||
Action? actionById(String? id) {
|
||||
if (id == null) return null;
|
||||
@@ -914,6 +948,7 @@ class Project {
|
||||
Map<int, int>? laneSlots,
|
||||
bool? autoSaveEnabled,
|
||||
int? autoSaveMinutes,
|
||||
ArchDoc? arch,
|
||||
}) {
|
||||
return Project(
|
||||
name: name ?? this.name,
|
||||
@@ -929,11 +964,12 @@ class Project {
|
||||
laneSlots: laneSlots ?? this.laneSlots,
|
||||
autoSaveEnabled: autoSaveEnabled ?? this.autoSaveEnabled,
|
||||
autoSaveMinutes: autoSaveMinutes ?? this.autoSaveMinutes,
|
||||
arch: arch ?? this.arch,
|
||||
);
|
||||
}
|
||||
|
||||
/// 序列化为 JSON。外层包含 `schema` 版本号,实际数据位于 `project` 子对象。
|
||||
Map<String, dynamic> toJson() => <String, dynamic>{
|
||||
/// 序列化为 JSON。[includeArch] 为 false 时省略架构图部分。
|
||||
Map<String, dynamic> toJson({bool includeArch = true}) => <String, dynamic>{
|
||||
'schema': schema,
|
||||
'project': <String, dynamic>{
|
||||
'name': name,
|
||||
@@ -950,11 +986,16 @@ class Project {
|
||||
},
|
||||
'autoSaveEnabled': autoSaveEnabled,
|
||||
'autoSaveMinutes': autoSaveMinutes,
|
||||
if (includeArch) 'arch': arch.toJson(),
|
||||
},
|
||||
};
|
||||
|
||||
/// 序列化为带两空格缩进的 JSON 文本,便于人工阅读与 diff。
|
||||
String encode() => const JsonEncoder.withIndent(' ').convert(toJson());
|
||||
///
|
||||
/// [includeArch] 为 false 时**不写入架构图部分**(时序图文档 `*.seq.json`
|
||||
/// 只含时序内容;架构图另存为 `*.arch.json`)。
|
||||
String encode({bool includeArch = true}) => const JsonEncoder.withIndent(' ')
|
||||
.convert(toJson(includeArch: includeArch));
|
||||
|
||||
/// 从 JSON 反序列化。
|
||||
///
|
||||
@@ -968,7 +1009,7 @@ class Project {
|
||||
final List<dynamic> pz = (p['phaseZones'] as List<dynamic>?) ?? <dynamic>[];
|
||||
return Project(
|
||||
name: p['name'] as String? ?? '未命名',
|
||||
schema: j['schema'] as String? ?? 'seqdiagram/1.2',
|
||||
schema: j['schema'] as String? ?? 'edc/1.3',
|
||||
cycle: Cycle.fromJson((p['cycle'] as Map<String, dynamic>?) ?? <String, dynamic>{}),
|
||||
stations: st.map((dynamic e) => Station.fromJson(e as Map<String, dynamic>)).toList(),
|
||||
actions: ac.map((dynamic e) => Action.fromJson(e as Map<String, dynamic>)).toList(),
|
||||
@@ -984,6 +1025,8 @@ class Project {
|
||||
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,
|
||||
arch: ArchDoc.fromJson(
|
||||
(p['arch'] as Map<String, dynamic>?) ?? <String, dynamic>{}),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user