feat(V1.0.1): 泳道/轨道支持多动作(同执行器多条不重叠);圆周弧可拖拽端点;依赖标签沿弧避让

- 泳道模型:layer 兼作泳道/轨道编号,同一泳道可放多个互不重叠动作(角区间重叠校验)
- 条形:上下拖拽换道;圆周:Shift+径向拖拽换轨;冲突时拒绝并提示
- 泳道标题合并显示(/ 分隔,≤2 行);左侧列表按泳道分组
- 圆周动作弧支持拖拽两端改起止角(弱吸附 + 径向虚线参考),整体拖拽旋转
- 圆周依赖标签沿圆弧切向排布,落入环间空隙,避免压住动作弧
- 版本 1.0.1+2;帮助/README 补充泳道说明;重新构建 dist
This commit is contained in:
呆头鹅
2026-09-18 17:54:35 +08:00
parent 279cc2318f
commit 339b96c73f
11 changed files with 483 additions and 196 deletions
+26 -21
View File
@@ -635,31 +635,36 @@ class AppController extends ChangeNotifier {
updateAction(id, (Action x) => x.copyWith(layer: nl), status: '层 L${nl + 1}');
}
/// 将动作 [id] 移动到条形视图的第 [targetIndex] 行(上下拖拽排序)。
/// 将动作 [id] 移动到第 [targetLane] 条泳道 / 轨道(上下拖拽换道)。
///
/// 会把所有动作的显式行序 `row` 重写为紧凑的 `0..n-1`,从而**固定行位置**,
/// 之后水平拖动只改相位、不再改变行。
void moveActionRow(String id, int targetIndex) {
/// 泳道可容纳多个动作;仅当目标泳道内存在**时间重叠**的动作时才拒绝,
/// 并给出状态提示(与音频轨道“不能重叠”的语义一致)。
void moveActionLane(String id, int targetLane) {
final Action? moving = _project.actionById(id);
if (moving == null) return;
final List<Action> list = orderActions(_project);
final int from = list.indexWhere((Action a) => a.id == id);
if (from < 0) return;
final Action a = list.removeAt(from);
final int to = targetIndex.clamp(0, list.length);
if (to == from) {
// 行序未变,但如果此前没有显式行序,则补齐一次。
final bool already = _project.actions.every((Action x) => x.row >= 0);
if (already) return;
final int lane = targetLane.clamp(0, 63);
if (lane == moving.layer) return;
final bool overlap = _project.actions.any((Action o) =>
o.id != id &&
o.layer == lane &&
angleRangesOverlap(moving.startAngle, moving.endAngle, o.startAngle, o.endAngle));
if (overlap) {
_status = '轨道 L${lane + 1} 在该时间段已有动作,无法放入';
notifyListeners();
return;
}
list.insert(to, a);
final Map<String, int> rowById = <String, int>{
for (int i = 0; i < list.length; i++) list[i].id: i,
};
final List<Action> actions = _project.actions
.map((Action x) => x.copyWith(row: rowById[x.id] ?? x.row))
.toList();
_mutate(_project.copyWith(actions: actions), status: '调整 $id 行序');
updateAction(id, (Action x) => x.copyWith(layer: lane, row: lane),
status: '移至轨道 L${lane + 1}');
}
/// 目标泳道 [lane] 是否能容纳动作 [id](不与其内动作时间重叠)。
bool canPlaceInLane(String id, int lane) {
final Action? a = _project.actionById(id);
if (a == null) return false;
return !_project.actions.any((Action o) =>
o.id != id &&
o.layer == lane &&
angleRangesOverlap(a.startAngle, a.endAngle, o.startAngle, o.endAngle));
}
/// 移动某个相位分区的一条边界(用于在条形图顶部直接拖拽分区)。