v1.3.10: 应用身份切换 cc.sincos.edc(彻底解决桌面名称); 移除尺寸标注与图元库自定义; 修复帮助中心空白与 Windows 更新包校验
This commit is contained in:
+1
-507
@@ -6,82 +6,15 @@
|
||||
/// 外层容器(宽度 / 边框 / 标题栏)由 `app_shell.dart` 负责,本文件只提供主体。
|
||||
library;
|
||||
|
||||
import 'dart:convert';
|
||||
import 'dart:io' show File;
|
||||
import 'dart:math' as math;
|
||||
import 'dart:typed_data';
|
||||
import 'dart:ui' show PathMetric, Tangent;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../arch/arch_models.dart';
|
||||
import '../arch/arch_painter.dart';
|
||||
import '../library/symbol_library.dart';
|
||||
import '../persistence/android_docs.dart';
|
||||
import '../sketch/sketch_models.dart';
|
||||
import '../sketch/sketch_solver.dart';
|
||||
import '../state/app_controller.dart';
|
||||
import '../theme/tokens.dart';
|
||||
import 'dialogs.dart';
|
||||
|
||||
/// 尺寸改值对话框(识别后图形 / 曲线 / 图元;右栏与画布标签共用逻辑)。
|
||||
Future<void> _editShapeDim(
|
||||
BuildContext context,
|
||||
AppController c,
|
||||
ArchShape s,
|
||||
ArchDimKind k,
|
||||
) async {
|
||||
final double cur = archShapeDimValue(s, k);
|
||||
final String? input = await showTextEditDialog(
|
||||
context,
|
||||
title: '编辑${archDimKindLabel(k)}(当前 ${cur.toStringAsFixed(1)} mm)',
|
||||
initial: cur.toStringAsFixed(1),
|
||||
);
|
||||
if (input == null) return;
|
||||
final double? v = double.tryParse(input.trim());
|
||||
if (v == null || v <= 0) {
|
||||
c.setStatus('数值无效:请输入正数');
|
||||
return;
|
||||
}
|
||||
c.setArchShapeDim(s.id, k, v);
|
||||
}
|
||||
|
||||
/// 图元预览画笔(100×100 归一化盒 → 控件尺寸;跳过文字保证小尺寸清晰)。
|
||||
class _SymPreviewPainter extends CustomPainter {
|
||||
/// 构造。
|
||||
_SymPreviewPainter(this.symbol, this.color);
|
||||
|
||||
final LibSymbol symbol;
|
||||
final Color color;
|
||||
|
||||
/// 绘制。
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
if (size.width <= 0 || size.height <= 0) return;
|
||||
canvas.save();
|
||||
canvas.scale(size.width / 100, size.height / 100);
|
||||
const Rect box = Rect.fromLTWH(0, 0, 100, 100);
|
||||
final Paint stroke = Paint()
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = 100 / size.width * 0.9
|
||||
..strokeCap = StrokeCap.round
|
||||
..strokeJoin = StrokeJoin.round
|
||||
..color = color;
|
||||
for (final SymPrim p in symbol.prims) {
|
||||
if (p.kind == SymPrimKind.text) continue;
|
||||
final Path? path = symPrimPath(p, box);
|
||||
if (path == null) continue;
|
||||
canvas.drawPath(path, stroke);
|
||||
}
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
/// 是否需要重绘。
|
||||
@override
|
||||
bool shouldRepaint(covariant _SymPreviewPainter old) =>
|
||||
old.symbol.id != symbol.id || old.color != color;
|
||||
}
|
||||
|
||||
/// 小节标题。
|
||||
Widget _sec(Tokens t, String s) => Text(
|
||||
s,
|
||||
@@ -116,8 +49,7 @@ class ArchLeftBody extends StatelessWidget {
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'笔迹一律扶正为标准图形(矩形 / 圆 / 箭头 / 折线 / 曲线):支持两笔组合、'
|
||||
'圆柱拼接与图元库匹配(库里有什么就能画什么);识别不了的保留为墨迹,'
|
||||
'可用「橡皮」擦除。文字请双击图形 / 空白处直接输入。',
|
||||
'圆柱拼接;识别不了的保留为墨迹,可用「橡皮」擦除。文字请双击图形 / 空白处直接输入。',
|
||||
style: TextStyle(color: t.dim, fontSize: 10, height: 1.5),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
@@ -332,8 +264,6 @@ class ArchLeftBody extends StatelessWidget {
|
||||
ArchShapeType.queue),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
_SymbolLibPanel(controller: c),
|
||||
const SizedBox(height: 14),
|
||||
_sec(t, '颜色'),
|
||||
const SizedBox(height: 8),
|
||||
@@ -604,91 +534,6 @@ class ArchRightBody extends StatelessWidget {
|
||||
style: TextStyle(color: t.sub, fontSize: 11),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Text('尺寸 · mm(点数值直接修改)',
|
||||
style: TextStyle(color: t.dim, fontSize: 10)),
|
||||
const Spacer(),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
final List<ArchDimKind> kinds = archShapeDimKinds(s);
|
||||
final bool all = kinds.every(s.dims.contains);
|
||||
for (final ArchDimKind k in kinds) {
|
||||
if (all == s.dims.contains(k)) {
|
||||
c.toggleArchShapeDim(s.id, k);
|
||||
}
|
||||
}
|
||||
},
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 5, vertical: 2),
|
||||
child: Text(
|
||||
archShapeDimKinds(s)
|
||||
.every(s.dims.contains)
|
||||
? '清除标注'
|
||||
: '标注全部',
|
||||
style: TextStyle(
|
||||
color: t.accent,
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
for (final ArchDimKind k in archShapeDimKinds(s))
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 3),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: 34,
|
||||
child: Text(archDimKindLabel(k),
|
||||
style: TextStyle(color: t.dim, fontSize: 11)),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () => _editShapeDim(context, c, s, k),
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 6, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: t.panel2,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
border: Border.all(color: t.line),
|
||||
),
|
||||
child: Text(
|
||||
'${archShapeDimValue(s, k).toStringAsFixed(1)} mm',
|
||||
style: TextStyle(
|
||||
color: t.accent2,
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
InkWell(
|
||||
onTap: () => c.toggleArchShapeDim(s.id, k),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(3),
|
||||
child: Icon(
|
||||
s.dims.contains(k)
|
||||
? Icons.label
|
||||
: Icons.label_outline,
|
||||
size: 14,
|
||||
color: s.dims.contains(k) ? t.accent : t.dim,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
_mini(t, '编辑文字', () => _editText(context, c, s)),
|
||||
@@ -1212,354 +1057,3 @@ class ArchRightBody extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===================== 图元库面板(可折叠 · Visio 式) =====================
|
||||
|
||||
/// 图元库面板:按分类折叠展示(默认全部收起,只展开选中的库),
|
||||
/// 点图元即插入画布;用户图元可删除;支持导入与「从选中图形存为图元」。
|
||||
class _SymbolLibPanel extends StatefulWidget {
|
||||
/// 构造。
|
||||
const _SymbolLibPanel({required this.controller});
|
||||
|
||||
/// 全局应用控制器。
|
||||
final AppController controller;
|
||||
|
||||
/// 创建状态。
|
||||
@override
|
||||
State<_SymbolLibPanel> createState() => _SymbolLibPanelState();
|
||||
}
|
||||
|
||||
/// 面板状态:记录当前展开的分类(同时只允许一个)。
|
||||
class _SymbolLibPanelState extends State<_SymbolLibPanel> {
|
||||
String? _openCategory;
|
||||
|
||||
/// 构建。
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Tokens t = context.tok;
|
||||
final AppController c = widget.controller;
|
||||
final Map<String, List<LibSymbol>> groups = <String, List<LibSymbol>>{};
|
||||
for (final LibSymbol s in SymbolCache.all) {
|
||||
groups.putIfAbsent(s.category, () => <LibSymbol>[]).add(s);
|
||||
}
|
||||
final List<String> cats = groups.keys.toList();
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Text('图元库(可扩展)',
|
||||
style: TextStyle(color: t.dim, fontSize: 10)),
|
||||
const Spacer(),
|
||||
InkWell(
|
||||
onTap: () => _symImport(context, c),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
|
||||
child: Text('导入图元…',
|
||||
style: TextStyle(
|
||||
color: t.accent,
|
||||
fontSize: 10.5,
|
||||
fontWeight: FontWeight.w600)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
for (final String cat in cats) ...<Widget>[
|
||||
InkWell(
|
||||
onTap: () => setState(() =>
|
||||
_openCategory = _openCategory == cat ? null : cat),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
child: Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
|
||||
margin: const EdgeInsets.only(bottom: 3),
|
||||
decoration: BoxDecoration(
|
||||
color: _openCategory == cat
|
||||
? t.accent.withValues(alpha: 0.10)
|
||||
: t.panel2,
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
border: Border.all(
|
||||
color: _openCategory == cat
|
||||
? t.accent.withValues(alpha: 0.5)
|
||||
: t.line,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
_openCategory == cat
|
||||
? Icons.expand_less
|
||||
: Icons.expand_more,
|
||||
size: 15,
|
||||
color: _openCategory == cat ? t.accent : t.sub,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'$cat(${groups[cat]!.length})',
|
||||
style: TextStyle(
|
||||
color: _openCategory == cat ? t.accent : t.sub,
|
||||
fontSize: 11,
|
||||
fontWeight: _openCategory == cat
|
||||
? FontWeight.w700
|
||||
: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
if (_openCategory == cat)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 6, right: 2, bottom: 4),
|
||||
child: Wrap(
|
||||
spacing: 6,
|
||||
runSpacing: 6,
|
||||
children: <Widget>[
|
||||
for (final LibSymbol sym in groups[cat]!) _symCard(t, c, sym),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 4),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: OutlinedButton.icon(
|
||||
onPressed:
|
||||
c.archSelIds.isEmpty ? null : () => _symFromSelection(context, c),
|
||||
icon: const Icon(Icons.add_box_outlined, size: 15),
|
||||
label: const Text('从选中图形存为图元'),
|
||||
style: OutlinedButton.styleFrom(
|
||||
visualDensity: VisualDensity.compact,
|
||||
textStyle: const TextStyle(
|
||||
fontSize: 11.5,
|
||||
fontFamily: 'Microsoft YaHei UI',
|
||||
fontFamilyFallback: <String>[
|
||||
'Microsoft YaHei',
|
||||
'Segoe UI',
|
||||
'sans-serif',
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 图元卡片(预览 + 名称;用户图元带删除角标)。
|
||||
Widget _symCard(Tokens t, AppController c, LibSymbol sym) {
|
||||
final bool user = !SymbolLibrary.isBuiltinId(sym.id);
|
||||
return InkWell(
|
||||
onTap: () => _insertSymbolShape(c, sym),
|
||||
borderRadius: BorderRadius.circular(9),
|
||||
child: Container(
|
||||
width: 82,
|
||||
height: 64,
|
||||
decoration: BoxDecoration(
|
||||
color: t.panel2,
|
||||
borderRadius: BorderRadius.circular(9),
|
||||
border: Border.all(color: t.line),
|
||||
),
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
Positioned.fill(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: 34,
|
||||
height: 30,
|
||||
child: CustomPaint(
|
||||
painter: _SymPreviewPainter(sym, t.sub),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 3),
|
||||
child: Text(
|
||||
sym.name,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(color: t.sub, fontSize: 9.5),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (user)
|
||||
Positioned(
|
||||
right: 0,
|
||||
top: 0,
|
||||
child: InkWell(
|
||||
onTap: () => _symDelete(c, sym),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(3),
|
||||
child: Icon(Icons.close, size: 12, color: t.dim),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 插入图元库符号(保持图元纵横比,位置在视口中心、可吸附网格)。
|
||||
void _insertSymbolShape(AppController c, LibSymbol sym) {
|
||||
final ArchDoc doc = c.arch;
|
||||
final Size vp = c.archViewport;
|
||||
final Offset center = vp.width < 10 || vp.height < 10
|
||||
? const Offset(400, 300)
|
||||
: Offset(
|
||||
(vp.width / 2 - doc.panX) / doc.zoom,
|
||||
(vp.height / 2 - doc.panY) / doc.zoom,
|
||||
);
|
||||
final Rect nat = symbolNaturalBounds(sym);
|
||||
final double scale = 140 / math.max(nat.width, nat.height);
|
||||
Rect r = Rect.fromCenter(
|
||||
center: center,
|
||||
width: nat.width * scale,
|
||||
height: nat.height * scale,
|
||||
);
|
||||
if (doc.gridSnap && doc.gridSize > 1) {
|
||||
final Offset tl = archSnapPoint(doc, r.topLeft);
|
||||
r = Rect.fromLTWH(tl.dx, tl.dy, r.width, r.height);
|
||||
}
|
||||
final int color = c.archColor;
|
||||
final ArchShape s = ArchShape(
|
||||
id: archNewId('S', doc.allIds),
|
||||
type: ArchShapeType.symbol,
|
||||
symbolId: sym.id,
|
||||
rect: r,
|
||||
fill: archFillOf(color),
|
||||
stroke: color,
|
||||
sw: 1.8,
|
||||
);
|
||||
c.addArchShape(s);
|
||||
c.selectArch(s.id);
|
||||
}
|
||||
|
||||
/// 删除用户图元(内置图元不可删)。
|
||||
Future<void> _symDelete(AppController c, LibSymbol sym) async {
|
||||
await SymbolLibrary.deleteUser(sym.id);
|
||||
await SymbolCache.refresh();
|
||||
c.setStatus('已删除图元「${sym.name}」');
|
||||
}
|
||||
|
||||
/// 导入图元文件(`*.symbol.json`;桌面文件浏览器 / 安卓公共目录)。
|
||||
Future<void> _symImport(BuildContext context, AppController c) async {
|
||||
try {
|
||||
String content;
|
||||
if (AndroidDocs.isAvailable) {
|
||||
final String? name = await showDialog<String>(
|
||||
context: context,
|
||||
builder: (_) => const AndroidFileDialog(
|
||||
saveMode: false,
|
||||
defaultName: '',
|
||||
suffix: '.symbol.json',
|
||||
),
|
||||
);
|
||||
if (name == null) return;
|
||||
final Uint8List? bytes = await AndroidDocs.readFile(name);
|
||||
if (bytes == null) {
|
||||
c.setStatus('导入失败:未找到文件 $name');
|
||||
return;
|
||||
}
|
||||
content = utf8.decode(bytes);
|
||||
} else {
|
||||
final String? path = await pickFile(
|
||||
context,
|
||||
save: false,
|
||||
suffix: '.symbol.json',
|
||||
);
|
||||
if (path == null) return;
|
||||
content = await File(path).readAsString();
|
||||
}
|
||||
final LibSymbol sym =
|
||||
LibSymbol.fromJson(jsonDecode(content) as Map<String, dynamic>);
|
||||
if (sym.id.isEmpty || sym.prims.isEmpty) {
|
||||
c.setStatus('导入失败:不是有效的图元文件');
|
||||
return;
|
||||
}
|
||||
await SymbolLibrary.saveUser(sym);
|
||||
await SymbolCache.refresh();
|
||||
c.setStatus('已导入图元「${sym.name}」(${sym.category})');
|
||||
} catch (e) {
|
||||
c.setStatus('导入失败:$e');
|
||||
}
|
||||
}
|
||||
|
||||
/// 把当前选中的图形保存为图元(可多选;几何按选中范围归一化到 100×100)。
|
||||
Future<void> _symFromSelection(BuildContext context, AppController c) async {
|
||||
final List<ArchShape> sel = <ArchShape>[
|
||||
for (final String id in c.archSelIds)
|
||||
if (c.arch.shapeById(id) != null) c.arch.shapeById(id)!,
|
||||
];
|
||||
if (sel.isEmpty) {
|
||||
c.setStatus('先选中要保存为图元的图形(可多选)');
|
||||
return;
|
||||
}
|
||||
final String? name = await showTextEditDialog(
|
||||
context,
|
||||
title: '保存为图元(名称)',
|
||||
initial: '自定义图元',
|
||||
);
|
||||
if (name == null || name.trim().isEmpty) return;
|
||||
final LibSymbol sym = _symbolFromShapes(sel, name.trim());
|
||||
await SymbolLibrary.saveUser(sym);
|
||||
await SymbolCache.refresh();
|
||||
c.setStatus('已保存图元「${sym.name}」到图元库(可点击插入 / 手绘识别)');
|
||||
}
|
||||
|
||||
/// 由图形集合生成图元(采样轮廓为折线 + 文本)。
|
||||
LibSymbol _symbolFromShapes(List<ArchShape> shapes, String name) {
|
||||
Rect union = shapes.first.bounds;
|
||||
for (final ArchShape s in shapes) {
|
||||
union = union.expandToInclude(s.bounds);
|
||||
}
|
||||
final double scale = 100 / math.max(union.width, union.height);
|
||||
final Offset c0 = union.center;
|
||||
Offset norm(Offset p) =>
|
||||
Offset((p.dx - c0.dx) * scale + 50, (p.dy - c0.dy) * scale + 50);
|
||||
final List<SymPrim> prims = <SymPrim>[];
|
||||
for (final ArchShape s in shapes) {
|
||||
final Path path = archShapePath(s);
|
||||
for (final PathMetric m in path.computeMetrics()) {
|
||||
final int count =
|
||||
math.max(6, (m.length * scale / 5).ceil()).clamp(6, 160);
|
||||
final List<double> flat = <double>[];
|
||||
for (int i = 0; i <= count; i++) {
|
||||
final Tangent? t = m.getTangentForOffset(m.length * i / count);
|
||||
if (t == null) continue;
|
||||
final Offset n2 = norm(t.position);
|
||||
flat.add(n2.dx);
|
||||
flat.add(n2.dy);
|
||||
}
|
||||
if (flat.length >= 4) {
|
||||
prims.add(SymPrim(kind: SymPrimKind.polyline, pts: flat));
|
||||
}
|
||||
}
|
||||
if (s.text.isNotEmpty) {
|
||||
final Offset n2 = norm(s.rect.center);
|
||||
prims.add(SymPrim(
|
||||
kind: SymPrimKind.text,
|
||||
pts: <double>[n2.dx - s.text.length * 2.5, n2.dy - 5],
|
||||
label: s.text,
|
||||
));
|
||||
}
|
||||
}
|
||||
return LibSymbol(
|
||||
id: 'user-${DateTime.now().millisecondsSinceEpoch}',
|
||||
name: name,
|
||||
category: '自定义',
|
||||
prims: prims,
|
||||
pins: const <SymPin>[],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -998,19 +998,6 @@ class _ArchViewState extends State<ArchView>
|
||||
}
|
||||
}
|
||||
}
|
||||
// 尺寸标签:双击进入改值(识别后图形 / 曲线 / 图元可直接编辑尺寸)。
|
||||
final (ArchShape, ArchDimKind)? dimHit =
|
||||
archShapeDimHitAt(c.arch, world, c.arch.zoom);
|
||||
if (dimHit != null) {
|
||||
final int now = DateTime.now().millisecondsSinceEpoch;
|
||||
final bool dbl = now - _lastClickMs < 400 &&
|
||||
(e.localPosition - _lastClickPos).distance < 28;
|
||||
if (dbl) {
|
||||
_lastClickMs = 0;
|
||||
_editDimLabel(dimHit.$1, dimHit.$2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
final (String?, ArchShape?) hit = _hitTest(world);
|
||||
final String? id = hit.$1;
|
||||
final ArchShape? shape = hit.$2;
|
||||
@@ -1585,23 +1572,6 @@ class _ArchViewState extends State<ArchView>
|
||||
_startConversion(pts, _symbolShapeFor(sym, b), removeIds: removeIds);
|
||||
}
|
||||
|
||||
/// 双击尺寸标签:输入数值直接缩放图形(识别后图形 / 曲线 / 图元)。
|
||||
Future<void> _editDimLabel(ArchShape s, ArchDimKind k) async {
|
||||
final double cur = archShapeDimValue(s, k);
|
||||
final String? input = await showTextEditDialog(
|
||||
context,
|
||||
title: '编辑${archDimKindLabel(k)}(当前 ${cur.toStringAsFixed(1)} mm)',
|
||||
initial: cur.toStringAsFixed(1),
|
||||
);
|
||||
if (input == null || !mounted) return;
|
||||
final double? v = double.tryParse(input.trim());
|
||||
if (v == null || v <= 0) {
|
||||
c.setStatus('数值无效:请输入正数');
|
||||
return;
|
||||
}
|
||||
c.setArchShapeDim(s.id, k, v);
|
||||
}
|
||||
|
||||
/// 提交手绘:统一按图形识别处理(识别失败保留墨迹),并尝试两笔组合识别。
|
||||
void _commitInk(List<Offset> pts) {
|
||||
if (pts.length < 5) return;
|
||||
|
||||
+11
-16
@@ -2503,7 +2503,7 @@ class _HelpDialogState extends State<HelpDialog> {
|
||||
'时序图 · 动作',
|
||||
'时序图 · 视图导出',
|
||||
'架构图 · 绘制识别',
|
||||
'架构图 · 尺寸导出',
|
||||
'架构图 · 编辑导出',
|
||||
'界面与快捷键',
|
||||
'关于',
|
||||
];
|
||||
@@ -2591,13 +2591,13 @@ class _HelpDialogState extends State<HelpDialog> {
|
||||
const SizedBox(width: 12),
|
||||
Container(width: 1, color: t.line2),
|
||||
const SizedBox(width: 12),
|
||||
// 右侧:当前分页内容(垂直滚动)。
|
||||
// 右侧:当前分页内容。
|
||||
// 每个分页自身就是可滚动列表(_section 返回 ListView),
|
||||
// 这里不能再套 SingleChildScrollView——无界高度会把内容撑空。
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
key: ValueKey<int>(_tab),
|
||||
child: IndexedStack(
|
||||
index: _tab,
|
||||
children: <Widget>[
|
||||
child: IndexedStack(
|
||||
index: _tab,
|
||||
children: <Widget>[
|
||||
// 目标:从首页进入正确模块、理解文档与数据位置。
|
||||
_section(t, <List<String>>[
|
||||
<String>['打开软件是空白首页', '软件采用「空白启动」:打开后进入首页(不再直接进时序图)。在首页选择要新建的文档类型,或打开已有文档。'],
|
||||
@@ -2639,21 +2639,17 @@ class _HelpDialogState extends State<HelpDialog> {
|
||||
_section(t, <List<String>>[
|
||||
<String>['工具条怎么用', '架构图顶部工具:选择 / 手绘 / 连线 / 橡皮,旁边是「识别 N」确认按钮(N = 待识别墨迹笔数)。'],
|
||||
<String>['手绘识别', '「手绘」工具下按住拖动:松手自动把笔迹扶正为标准图形(矩形 / 圆 / 箭头 / 折线 / 曲线 / 云 / 圆柱……);识别不了的保留为墨迹,可用橡皮擦掉。'],
|
||||
<String>['多笔组合识别', '支持两笔组合(如两笔试画一个矩形)、圆柱拼接(顶盖 + 柱体);与上一笔刚生成的图形也能在 2.5 秒内合并成图元(如 圆 + 叉 = 指示灯)。'],
|
||||
<String>['多笔组合识别', '支持两笔组合(如两笔试画一个矩形)、圆柱拼接(顶盖 + 柱体);与上一笔刚生成的图形也能在 2.5 秒内合并。'],
|
||||
<String>['平板手写总识别不准', '左栏「手绘识别」关闭「松手自动识别」(安卓默认关闭):笔迹先保留为墨迹,画完点顶部「识别(N)」按钮统一确认,识别更从容。'],
|
||||
<String>['图元库(可扩展)', '左栏「图元库」按分类折叠(默认收起,只展开选中的库):点图元即插入画布(保持比例、自动吸附网格)。内置电气图元与 IT 图元(服务器 / 客户端 / 移动端 / 防火墙 / 交换机 / 消息队列)。'],
|
||||
<String>['自定义图元', '「导入图元…」读取 *.symbol.json(可分享给同事);「从选中图形存为图元」把画布上的图形(可多选)保存进图元库;用户图元带 × 可删除。'],
|
||||
<String>['手绘识别能用图元库吗', '能:内置识别不了的笔迹会与图元库轮廓匹配——库里有什么,就能手绘识别出什么。'],
|
||||
<String>['图形库', '左栏「图形库」内置标准图形(矩形 / 圆角矩形 / 椭圆 / 圆 / 三角 / 菱形 / 六边形 / 圆柱 / 云)与 IT 图元(服务器 / 客户端 / 移动端 / 防火墙 / 交换机 / 消息队列),点一下即插入画布。'],
|
||||
<String>['橡皮', '「橡皮」工具:拖过图形 / 墨迹 / 连线即擦除;一次连续擦除算一步撤销(Ctrl+Z 可整段回退)。'],
|
||||
<String>['文字怎么输入', '双击图形 → 编辑图形文字;双击连线 → 编辑标签;双击空白 → 新建文本(输入法直接打字)。'],
|
||||
<String>['图层', '左栏「图层」:新建 / 可见(眼睛)/ 锁定(锁)/ 颜色 / 双击改名。隐藏图层不绘制不可选;锁定图层可见但不可选(仍可作吸附参照)。'],
|
||||
<String>['标尺与辅助', '四边标尺单位固定为 mm(垂直轴数值在右侧);F8 正交移动 / F10 极轴追踪(角度在左栏设置);支持网格吸附与磁力对齐线。'],
|
||||
<String>['默认图纸', '新建架构图的画布为 A0 图纸(1189×841 mm,1 世界单位 = 1 mm),自动适配视口;画布上绘制浅色 A0 边界。'],
|
||||
]),
|
||||
// 目标:架构图尺寸标注、编辑操作与导出。
|
||||
// 目标:架构图编辑操作与导出。
|
||||
_section(t, <List<String>>[
|
||||
<String>['给图形标尺寸(mm)', '选中图形 / 曲线 / 图元 → 右栏「尺寸 · mm」区:宽度 / 高度 / 长度 / 直径(按类型给出)点数值直接输入新值,几何按比例缩放(中心保持),无需草图约束。'],
|
||||
<String>['画布上显示尺寸', '尺寸区右上角「标注全部 / 清除标注」一键开关;开启后画布上显示 W / H / L / ⌀ 标签(屏幕字号恒定),双击标签即可改值。'],
|
||||
<String>['连线规则', '连线一律正交(横平竖直),不会出现斜线;端点自动吸附图形边框,选中后拖拽路径上的角点可调整走线位置;端点也可拖到别的图形重新吸附或脱离。'],
|
||||
<String>['对齐 / 均布', '框选或 Ctrl 多选后,右栏出现 8 个对齐按钮:左 / 横向居中 / 右、顶 / 纵向居中 / 底、横向均布、纵向均布(以选中范围为参照,均布需 ≥3 个)。'],
|
||||
<String>['层级 / 复制 / 删除', '选中后右栏可「上移一层 / 下移一层」;拖拽移动、白色手柄缩放;Delete 删除选中;Ctrl+A 全选。'],
|
||||
@@ -2674,8 +2670,7 @@ class _HelpDialogState extends State<HelpDialog> {
|
||||
]),
|
||||
// 关于:设计人、版本、版权、授权信息与本机 MAC。
|
||||
_about(context, t),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -120,11 +120,11 @@ class _UpdateDialogState extends State<UpdateDialog> {
|
||||
|
||||
// 兼容两种打包方式:zip 根目录即程序文件,或多包一层 dist/。
|
||||
String srcDir = extractDir;
|
||||
if (!File('$extractDir\\sequence_diagram.exe').existsSync()) {
|
||||
if (File('$extractDir\\dist\\sequence_diagram.exe').existsSync()) {
|
||||
if (!File('$extractDir\\EasyDesignCollection.exe').existsSync()) {
|
||||
if (File('$extractDir\\dist\\EasyDesignCollection.exe').existsSync()) {
|
||||
srcDir = '$extractDir\\dist';
|
||||
} else {
|
||||
throw Exception('更新包内容不完整(未找到 sequence_diagram.exe)');
|
||||
throw Exception('更新包内容不完整(未找到 EasyDesignCollection.exe)');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,13 +137,13 @@ class _UpdateDialogState extends State<UpdateDialog> {
|
||||
File(batPath).writeAsStringSync(
|
||||
'@echo off\r\n'
|
||||
':wait\r\n'
|
||||
'tasklist /fi "IMAGENAME eq sequence_diagram.exe" | find /i "sequence_diagram.exe" >nul\r\n'
|
||||
'tasklist /fi "IMAGENAME eq EasyDesignCollection.exe" | find /i "EasyDesignCollection.exe" >nul\r\n'
|
||||
'if not errorlevel 1 (\r\n'
|
||||
' ping -n 1 -w 600 127.0.0.1 >nul\r\n'
|
||||
' goto wait\r\n'
|
||||
')\r\n'
|
||||
'xcopy /e /i /y /q "%~1\\*" "%~2\\"\r\n'
|
||||
'start "" "%~2\\sequence_diagram.exe"\r\n'
|
||||
'start "" "%~2\\EasyDesignCollection.exe"\r\n'
|
||||
'del "%~f0"\r\n',
|
||||
flush: true,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user