fix(view): 消除遮罩——圆周 0° 起点标记/顺时针箭头外移、退化依赖改短箭头、条形依赖标签上移;同步 dist
- 圆周:0° 起点标记移到刻度数字之外,避免遮挡顶部 0° 标签 - 圆周:顺时针 CW 箭头进一步外移,不再冲入视图 - 圆周:起止角相同时依赖退化为径向直线,改为贴近目标环的短箭头 - 条形:FS/SS 标签上移,避免压住箭头与动作条 - 适应视图按新的外圈元素增大内容半径 - 重新构建 dist 生成物
This commit is contained in:
@@ -429,7 +429,8 @@ class BarPainter extends CustomPainter {
|
||||
);
|
||||
_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), label, col, crit);
|
||||
// 标签上移,避免压住箭头(箭头在更靠近目标条块的一侧)。
|
||||
_chip(canvas, Offset(chipX, chipY - 11), label, col, crit);
|
||||
k++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,11 +404,31 @@ class CircularPainter extends CustomPainter {
|
||||
final Color col = d.type == DepType.fs ? tokens.fs : tokens.ss;
|
||||
final bool crit = criticalDeps.contains('${d.fromId}->${d.toId}');
|
||||
|
||||
final Path p = Path()
|
||||
..moveTo(p0.dx, p0.dy)
|
||||
..lineTo(p1.dx, p1.dy)
|
||||
..arcToPoint(p2, radius: Radius.circular(rC), largeArc: large == 1, clockwise: cw)
|
||||
..lineTo(p3.dx, p3.dy);
|
||||
// 起止角相同(FS 紧随其后)时路径会退化为一条从圆心附近拉出的径向直线,
|
||||
// 看起来像“杂线”。此时改为贴近目标环的**短箭头**,并让标签旁移。
|
||||
final bool degenerate = (aStart - aEnd).abs() < 0.5;
|
||||
final Path p;
|
||||
final Offset tipDir;
|
||||
final Offset chipPos;
|
||||
if (degenerate) {
|
||||
final double r0 = rTip - (rTip > rB ? 28 : -28);
|
||||
final Offset q0 = polar(c, r0, aStart);
|
||||
p = Path()
|
||||
..moveTo(q0.dx, q0.dy)
|
||||
..lineTo(p3.dx, p3.dy);
|
||||
tipDir = p3 - q0;
|
||||
chipPos = polar(c, (rA + rB) / 2, aStart + 12);
|
||||
} else {
|
||||
p = Path()
|
||||
..moveTo(p0.dx, p0.dy)
|
||||
..lineTo(p1.dx, p1.dy)
|
||||
..arcToPoint(p2, radius: Radius.circular(rC), largeArc: large == 1, clockwise: cw)
|
||||
..lineTo(p3.dx, p3.dy);
|
||||
tipDir = p3 - p2;
|
||||
final double span = (aStart - aEnd).abs();
|
||||
final double rChip = skip ? rC : (span < 30 ? rB + layout.th / 2 + 10 : rC);
|
||||
chipPos = polar(c, rChip, (aEnd + aStart) / 2);
|
||||
}
|
||||
|
||||
if (crit) {
|
||||
canvas.drawPath(
|
||||
@@ -428,17 +448,12 @@ class CircularPainter extends CustomPainter {
|
||||
..strokeCap = StrokeCap.round
|
||||
..color = col,
|
||||
);
|
||||
_arrow(canvas, p3, p3 - p2, col);
|
||||
_arrow(canvas, p3, tipDir, col);
|
||||
|
||||
// 标签胶囊放置在连线中段:跨层时贴最外圈,短跨度时外移避免压线。
|
||||
final double theta = (aEnd + aStart) / 2;
|
||||
final double span = (aStart - aEnd).abs();
|
||||
final double rChip = skip ? rC : (span < 30 ? rB + layout.th / 2 + 10 : rC);
|
||||
final Offset mid = polar(c, rChip, theta);
|
||||
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';
|
||||
_chip(canvas, mid, '${A.id}→${B.id} $label', col, crit);
|
||||
_chip(canvas, chipPos, '${A.id}→${B.id} $label', col, crit);
|
||||
}
|
||||
|
||||
/// 在 [tip] 处绘制指向 [dir] 方向的实心三角箭头。
|
||||
@@ -487,7 +502,8 @@ class CircularPainter extends CustomPainter {
|
||||
/// 绘制 0° 起点标记:顶部朝下的三角与“0° · 12 点钟”文字。
|
||||
void _startMarker(Canvas canvas, CircularLayout layout) {
|
||||
final Offset c = layout.center;
|
||||
final double r = layout.tickR + 12;
|
||||
// 放在刻度数字之外,避免与顶部的“0°”刻度标签重叠。
|
||||
final double r = layout.tickR + 46;
|
||||
final Offset tip = Offset(c.dx, c.dy - r - 22);
|
||||
final Path p = Path()
|
||||
..moveTo(tip.dx, tip.dy)
|
||||
@@ -502,8 +518,8 @@ class CircularPainter extends CustomPainter {
|
||||
/// 绘制顺时针方向指示:一段外圈圆弧、箭头与“顺时针 CW”文字。
|
||||
void _cwArrow(Canvas canvas, CircularLayout layout) {
|
||||
final Offset c = layout.center;
|
||||
// 放在刻度环之外,避免“冲进”视图内部。
|
||||
final double r = layout.tickR + 16;
|
||||
// 放在刻度数字之外更远处,避免“冲进”视图内部。
|
||||
final double r = layout.tickR + 56;
|
||||
final Path p = arcPath(c, r, 20, 70);
|
||||
canvas.drawPath(
|
||||
p,
|
||||
|
||||
Reference in New Issue
Block a user