fix(ui): 同泳道依赖改水平连线;圆周依赖标签沿弧显示;导出改独立按钮;换道高亮目标泳道
- 同泳道依赖:源/目标同 y 时水平直线连接,标签置于线上方,不再压住箭头/色块 - 圆周依赖标签改用沿弧文字(与动作名一致),不再显示为竖直矩形 - 紧凑工具栏导出恢复为「导出 SVG / 导出 PNG」两个独立按钮 - 上下换泳道时高亮目标泳道(可放置=强调色,重叠=警示色) - 重新构建 dist
This commit is contained in:
@@ -464,37 +464,15 @@ class CircularPainter extends CustomPainter {
|
||||
String label = d.type == DepType.fs ? 'FS' : 'SS+${d.offsetAngle.toStringAsFixed(0)}°';
|
||||
if (d.type == DepType.ff) label = 'FF';
|
||||
if (d.type == DepType.sf) label = 'SF';
|
||||
_arcChip(canvas, c, chipR, chipDeg, '${A.id}→${B.id} $label', col, crit);
|
||||
}
|
||||
|
||||
/// 沿圆弧切向绘制依赖标签胶囊,使其贴合环间空隙、不压住动作弧。
|
||||
void _arcChip(Canvas canvas, Offset c, double r, double midDeg, String label, Color col, bool crit) {
|
||||
final TextPainter tp = _tp(label, 10, col, FontWeight.w600);
|
||||
final double w = tp.width + 16 + (crit ? 18 : 0);
|
||||
const double h = 17;
|
||||
final Offset pos = polar(c, r, midDeg);
|
||||
final double rad = midDeg * math.pi / 180;
|
||||
final bool flip = midDeg > 90 && midDeg < 270;
|
||||
canvas.save();
|
||||
canvas.translate(pos.dx, pos.dy);
|
||||
canvas.rotate(flip ? rad + math.pi : rad);
|
||||
final Rect rect = Rect.fromCenter(center: Offset.zero, width: w, height: h);
|
||||
canvas.drawRRect(RRect.fromRectAndRadius(rect, const Radius.circular(6)), Paint()..color = tokens.chip);
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(rect, const Radius.circular(6)),
|
||||
Paint()
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = 1
|
||||
..color = col,
|
||||
);
|
||||
double tx = rect.left + 8;
|
||||
// 依赖标签沿圆弧切向排布(与动作名一致),呈现“圆弧效果”。
|
||||
final double arcLen = 2 * math.pi * chipR * 0.9;
|
||||
_arcLabel(canvas, c, chipR, chipDeg, '${A.id}→${B.id} $label', col, 10,
|
||||
math.max(math.min(arcLen, 200), 40));
|
||||
if (crit) {
|
||||
canvas.drawCircle(Offset(rect.left + 8, 0), 6.5, Paint()..color = tokens.crit);
|
||||
_text(canvas, '★', Offset(rect.left + 8, 0), color: tokens.onAccent, size: 10, align: TextAlign.center);
|
||||
tx = rect.left + 18;
|
||||
final Offset sp = polar(c, chipR, chipDeg);
|
||||
canvas.drawCircle(sp.translate(-46, 0), 7, Paint()..color = tokens.crit);
|
||||
_text(canvas, '★', sp.translate(-46, 0), color: tokens.onAccent, size: 9, align: TextAlign.center, weight: FontWeight.w700);
|
||||
}
|
||||
tp.paint(canvas, Offset(tx, -tp.height / 2));
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
/// 在 [tip] 处绘制指向 [dir] 方向的实心三角箭头。
|
||||
|
||||
Reference in New Issue
Block a user