fix(ui): 同泳道依赖改水平连线;圆周依赖标签沿弧显示;导出改独立按钮;换道高亮目标泳道

- 同泳道依赖:源/目标同 y 时水平直线连接,标签置于线上方,不再压住箭头/色块
- 圆周依赖标签改用沿弧文字(与动作名一致),不再显示为竖直矩形
- 紧凑工具栏导出恢复为「导出 SVG / 导出 PNG」两个独立按钮
- 上下换泳道时高亮目标泳道(可放置=强调色,重叠=警示色)
- 重新构建 dist
This commit is contained in:
呆头鹅
2026-09-18 18:04:35 +08:00
parent 339b96c73f
commit b494356326
4 changed files with 71 additions and 58 deletions
+46 -4
View File
@@ -46,6 +46,8 @@ class BarPainter extends CustomPainter {
required this.criticalDeps,
required this.selectedIds,
this.guideAngle,
this.dropLane,
this.dropValid = true,
});
/// 待绘制的工程数据源。
@@ -62,6 +64,12 @@ class BarPainter extends CustomPainter {
/// 拖拽相位分区边界时的参考角(度);非空时绘制一条竖直虚线参考。
final double? guideAngle;
/// 上下拖拽换泳道时,光标所在的目标泳道号;非空时高亮该泳道。
final int? dropLane;
/// 目标泳道是否可放置(时间不重叠);false 时用警示色高亮。
final bool dropValid;
/// 标尺横线所在的 y 坐标(画布坐标)。
static const double axisTop = 138;
/// 相位色带的顶部 y 坐标。
@@ -79,6 +87,28 @@ class BarPainter extends CustomPainter {
final double cycle = project.cycle.durationMs;
if (project.viewState.showPhaseBands) _phaseBands(canvas, layout);
// 换泳道拖拽:高亮目标泳道(可放置=强调色,重叠=警示色)。
if (dropLane != null && layout.lanes.contains(dropLane)) {
final double y = layout.yForLane(dropLane!);
final Color c = dropValid ? tokens.accent : tokens.danger;
canvas.drawRRect(
RRect.fromRectAndRadius(
Rect.fromLTWH(20, y - 8, layout.plotRight - 20, BarLayout.rowVisual),
const Radius.circular(10),
),
Paint()..color = c.withValues(alpha: 0.12),
);
canvas.drawRRect(
RRect.fromRectAndRadius(
Rect.fromLTWH(20, y - 8, layout.plotRight - 20, BarLayout.rowVisual),
const Radius.circular(10),
),
Paint()
..style = PaintingStyle.stroke
..strokeWidth = 1.4
..color = c.withValues(alpha: 0.8),
);
}
if (project.viewState.showRuler) _ruler(canvas, layout, u, cycle);
_boundaries(canvas, layout);
_rows(canvas, layout, u, cycle);
@@ -399,9 +429,16 @@ class BarPainter extends CustomPainter {
final Path p = Path();
double chipX;
final double chipY = gapY;
// 相邻行:短折线,直接从源端折向目标条块上方。
if ((ib - ia).abs() <= 1) {
double chipY;
// 同一泳道内的依赖(源/目标同 y):水平直线连接,标签置于线上方。
final bool sameLane = (ty - sy).abs() < 1;
if (sameLane) {
p.moveTo(ex, sy);
p.lineTo(tx, sy);
chipX = (ex + tx) / 2;
chipY = sy - 14;
} else if ((ib - ia).abs() <= 1) {
chipY = gapY;
p.moveTo(ex, sy + dir * 13);
p.lineTo(ex, gapY);
p.lineTo(tx, gapY);
@@ -432,6 +469,7 @@ class BarPainter extends CustomPainter {
p.lineTo(tx, gapY);
p.lineTo(tx, tipY - dir * 12);
chipX = (lane + tx) / 2;
chipY = gapY;
}
// 关键路径依赖:先铺一层加粗低透明度光晕,再画主线。
if (crit) {
@@ -452,7 +490,11 @@ class BarPainter extends CustomPainter {
..strokeCap = StrokeCap.round
..color = col.withValues(alpha: 0.95),
);
_arrow(canvas, Offset(tx, tipY), Offset(0, dir), col);
if (sameLane) {
_arrow(canvas, Offset(tx, sy), const Offset(1, 0), col);
} else {
_arrow(canvas, Offset(tx, tipY), Offset(0, dir), col);
}
final String label = d.type == DepType.fs ? 'FS 顺序' : 'SS +${d.offsetAngle.toStringAsFixed(0)}°';
// 标签上移,避免压住箭头(箭头在更靠近目标条块的一侧)。
_chip(canvas, Offset(chipX, chipY - 11), label, col, crit);