架构图增强:橡皮、手动确认识别(平板推荐)、连线一律正交+角点拖拽、手绘/连线职责分离、尺寸标注一键操作;帮助文件大规模更新;修复品牌按钮与 pubspec 描述
This commit is contained in:
@@ -10,7 +10,7 @@ library;
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io' show File;
|
||||
import 'dart:io' show File, Platform;
|
||||
import 'dart:math' as math;
|
||||
import 'dart:typed_data';
|
||||
|
||||
@@ -435,10 +435,55 @@ class AppController extends ChangeNotifier {
|
||||
ArchTool.select => '工具:选择',
|
||||
ArchTool.pen => '工具:手绘(松手自动识别)',
|
||||
ArchTool.connect => '工具:连线(拖到图形自动吸附)',
|
||||
ArchTool.eraser => '工具:橡皮(拖过图形 / 墨迹 / 连线即擦除)',
|
||||
};
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// 手绘是否「松手自动识别」。
|
||||
///
|
||||
/// 关闭时:笔迹先保留为墨迹,点「识别」按钮统一确认识别——平板手写
|
||||
/// 识别误判较多时的推荐模式(安卓默认关闭,桌面默认开启)。
|
||||
bool _archAutoRecognize = !Platform.isAndroid;
|
||||
|
||||
/// 手绘是否松手自动识别。
|
||||
bool get archAutoRecognize => _archAutoRecognize;
|
||||
|
||||
/// 切换手绘识别模式(自动 / 手动确认)。
|
||||
void setArchAutoRecognize(bool on) {
|
||||
if (_archAutoRecognize == on) return;
|
||||
_archAutoRecognize = on;
|
||||
_status = on
|
||||
? '手绘:松手自动识别'
|
||||
: '手绘:手动确认识别(画完点顶部「识别」按钮)';
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// 橡皮擦开始:压一次撤销快照(一次连续擦除 = 一步撤销)。
|
||||
void beginArchErase() {
|
||||
_undo.add(_project);
|
||||
if (_undo.length > 200) _undo.removeAt(0);
|
||||
_redo.clear();
|
||||
}
|
||||
|
||||
/// 擦除对象(图形 / 墨迹 / 连线;不入撤销栈,由 [beginArchErase] 快照统一回退)。
|
||||
///
|
||||
/// 返回实际擦除数量;删除图形时吸附其上的连线一并移除。
|
||||
int eraseArchIds(Set<String> ids) {
|
||||
final Set<String> hit = <String>{
|
||||
for (final String id in ids)
|
||||
if (arch.shapeById(id) != null ||
|
||||
arch.strokeById(id) != null ||
|
||||
arch.connectorById(id) != null)
|
||||
id,
|
||||
};
|
||||
if (hit.isEmpty) return 0;
|
||||
_project = _project.copyWith(arch: arch.removeIds(hit));
|
||||
_dirty = true;
|
||||
notifyListeners();
|
||||
return hit.length;
|
||||
}
|
||||
|
||||
// ===================== 参数化草图 =====================
|
||||
|
||||
/// 是否处于参数化草图模式。
|
||||
|
||||
Reference in New Issue
Block a user