feat(touch): 单指点选+按住移动动作、端点把手拖拽改时长(触屏目标加大);空白单指不平移

- 选中动作后两端绘制白色把手,端点抓取半径触屏 28px(桌面保持 8px 精确),命中容差 14px

- 短条两端都够得着时抓离手指更近的一端,居中则整体移动

- 触屏空白单指不再平移画布(单指只做选择/编辑,双指捏合缩放+平移);Windows 操作模式不变

- 重建签名 APK
This commit is contained in:
admin
2026-10-07 22:44:28 +08:00
parent 2b04705ba8
commit e99f144793
6 changed files with 88 additions and 26 deletions
+8 -7
View File
@@ -190,11 +190,12 @@ class BarLayout {
/// 命中测试:返回坐标 [p] 处最上层的动作,未命中返回 null。
///
/// 从后往前遍历(后绘制的在上层),并向外膨胀 4px 提升可点性。
Action? hitTest(Offset p) {
/// 从后往前遍历(后绘制的在上层),并按 [slop] 向外膨胀矩形提升可点性
/// (触屏平台可传入更大的容差)。
Action? hitTest(Offset p, {double slop = 4}) {
for (int i = ordered.length - 1; i >= 0; i--) {
final Action a = ordered[i];
final Rect r = rectFor(a).inflate(4);
final Rect r = rectFor(a).inflate(slop);
if (r.contains(p)) return a;
}
return null;
@@ -281,16 +282,16 @@ class CircularLayout {
/// 命中测试:返回坐标 [p] 命中的动作,未命中返回 null。
///
/// 算法:计算点相对圆心的距离 [d] 与角度 [a];遍历所有动作,先按径向
/// 距离过滤(与所在环的偏差不超过半个环宽 + 3px),再判断角度是否落在
/// 该动作弧段内;在候选中取径向偏差最小者。
Action? hitTest(Offset p) {
/// 距离过滤(与所在环的偏差不超过半个环宽 + [slop]),再判断角度是否落在
/// 该动作弧段内;在候选中取径向偏差最小者(触屏平台可传入更大的容差)。
Action? hitTest(Offset p, {double slop = 3}) {
final double d = (p - center).distance;
final double a = angleOf(center, p);
Action? best;
double bestDelta = double.infinity;
for (final Action a2 in project.actions) {
final double r = radiusFor(a2.layer);
if ((d - r).abs() > ringWidth / 2 + 3) continue;
if ((d - r).abs() > ringWidth / 2 + slop) continue;
if (_inArc(a2, a)) {
final double delta = (d - r).abs();
if (delta < bestDelta) {