feat(ui): 动作两端改为方头小圆角(长度即真实时长);更新图标按设计稿重绘
- 条形视图:动作条圆角 8→3,两端方头(仅小圆角),长度严格等于真实时长 - 圆周视图:动作弧改为填充弧带(方头 + 小圆角)替代圆头描边, 消除「圆头端帽在两端各多出半个环宽」造成的长度误读 - SVG 导出同步:条块 rx=3、动作弧 stroke-linecap=butt,导出与屏幕一致 - 更新按钮图标按 docs/更新.svg 设计稿矢量重绘(圆环 + 上箭头 + 两条底座横杠), 替换原来的 refresh 图标;更新对话框标题图标同步 - 右下角缩略预览(条形 / 圆周)动作线条细化至约 2px - 版本 1.2.1+13
This commit is contained in:
@@ -337,15 +337,15 @@ class BarPainter extends CustomPainter {
|
||||
final bool sel = selectedIds.contains(a.id);
|
||||
final bool crit = criticalActions.contains(a.id);
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(r.shift(const Offset(1.5, 2)), const Radius.circular(8)),
|
||||
RRect.fromRectAndRadius(r.shift(const Offset(1.5, 2)), const Radius.circular(3)),
|
||||
Paint()..color = tokens.shadow.withValues(alpha: tokens.shadowOp),
|
||||
);
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(r, const Radius.circular(8)),
|
||||
RRect.fromRectAndRadius(r, const Radius.circular(3)),
|
||||
Paint()..color = c.withValues(alpha: 0.92),
|
||||
);
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(r, const Radius.circular(8)),
|
||||
RRect.fromRectAndRadius(r, const Radius.circular(3)),
|
||||
Paint()
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = 1
|
||||
@@ -353,7 +353,7 @@ class BarPainter extends CustomPainter {
|
||||
);
|
||||
if (crit) {
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(r, const Radius.circular(8)),
|
||||
RRect.fromRectAndRadius(r, const Radius.circular(3)),
|
||||
Paint()
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = 2
|
||||
@@ -369,7 +369,7 @@ class BarPainter extends CustomPainter {
|
||||
final double wx = layout.xFor(a.endAngle - 360) - layout.plotLeft;
|
||||
final Rect tail = Rect.fromLTWH(layout.plotLeft, r.top, math.max(wx, 2), r.height);
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(tail, const Radius.circular(8)),
|
||||
RRect.fromRectAndRadius(tail, const Radius.circular(3)),
|
||||
Paint()..color = c.withValues(alpha: tokens.tailOp),
|
||||
);
|
||||
_text(canvas, '跨循环延续 ${(a.endAngle - 360).toStringAsFixed(0)}°',
|
||||
|
||||
@@ -310,25 +310,13 @@ class CircularPainter extends CustomPainter {
|
||||
for (int k = 0; k < segs.length; k++) {
|
||||
// 第二段且为跨循环时视为“尾巴”,需淡化处理。
|
||||
final bool tail = a.wrap && k == 1;
|
||||
final Path p = arcPath(c, r, segs[k][0], segs[k][1]);
|
||||
// 方头 + 小圆角:路径角度严格等于真实起止角,弧带长度即真实时长
|
||||
//(原来的圆头端帽会在两端各多出半个环宽,造成长度误读)。
|
||||
final Path p = _bandPath(c, r, th, segs[k][0], segs[k][1], 3);
|
||||
// 圆周色块不加描边 / 阴影,保持干净。
|
||||
canvas.drawPath(
|
||||
p,
|
||||
Paint()
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = th
|
||||
..strokeCap = a.wrap ? StrokeCap.butt : StrokeCap.round
|
||||
..color = col.withValues(alpha: tail ? tokens.tailOp : 1),
|
||||
);
|
||||
canvas.drawPath(p, Paint()..color = col.withValues(alpha: tail ? tokens.tailOp : 1));
|
||||
if (tail) {
|
||||
canvas.drawPath(
|
||||
p,
|
||||
Paint()
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = th
|
||||
..strokeCap = StrokeCap.butt
|
||||
..color = col.withValues(alpha: 0.9),
|
||||
);
|
||||
canvas.drawPath(p, Paint()..color = col.withValues(alpha: 0.9));
|
||||
}
|
||||
}
|
||||
if (crit) {
|
||||
@@ -377,6 +365,64 @@ class CircularPainter extends CustomPainter {
|
||||
_arcLabel(canvas, c, r, mid, '$step. ${a.id} ${a.name}', tokens.arcText, 11, math.max(arcLen - 12, 20));
|
||||
}
|
||||
|
||||
/// 构造「方头 + 小圆角」的圆环动作带(填充路径)。
|
||||
///
|
||||
/// 与「圆头描边」不同,路径覆盖的角度范围严格等于 [a0] → [a1](顺时针):
|
||||
/// 两端为径向直边、四角带 [cornerR] 的小圆角,因此弧带的长度就是动作的
|
||||
/// 真实时长,不会再像圆头端帽那样在两端各多出半个环宽造成长度误读。
|
||||
Path _bandPath(Offset c, double r, double w, double a0, double a1, double cornerR) {
|
||||
final double ro = r + w / 2;
|
||||
final double ri = r - w / 2;
|
||||
final double rc = math.min(cornerR, w / 2 - 0.5);
|
||||
final double span = a1 - a0;
|
||||
final Path p = Path();
|
||||
if (rc <= 0.5 || span <= 0.5) {
|
||||
// 退化情形:直接方头四边形。
|
||||
final Offset a = polar(c, ro, a0);
|
||||
p.moveTo(a.dx, a.dy);
|
||||
final Offset b = polar(c, ro, a1);
|
||||
p.lineTo(b.dx, b.dy);
|
||||
final Offset d = polar(c, ri, a1);
|
||||
p.lineTo(d.dx, d.dy);
|
||||
final Offset e = polar(c, ri, a0);
|
||||
p.lineTo(e.dx, e.dy);
|
||||
p.close();
|
||||
return p;
|
||||
}
|
||||
// 小圆角在内 / 外缘占用的角向宽度(度),不超过跨度的 40%。
|
||||
final double dOut = math.min(rc / ro * 180 / math.pi, span * 0.4);
|
||||
final double dIn = math.min(rc / ri * 180 / math.pi, span * 0.4);
|
||||
final Offset oStart = polar(c, ro, a0 + dOut);
|
||||
final Offset oEnd = polar(c, ro, a1 - dOut);
|
||||
final Offset iEnd = polar(c, ri, a1 - dIn);
|
||||
final Offset iStart = polar(c, ri, a0 + dIn);
|
||||
p.moveTo(oStart.dx, oStart.dy);
|
||||
// 外缘弧(顺时针)
|
||||
p.arcToPoint(oEnd,
|
||||
radius: Radius.circular(ro), largeArc: span - 2 * dOut > 180, clockwise: true);
|
||||
// 尾端:外角 → 小圆角 → 端面 → 小圆角 → 内缘
|
||||
final Offset co = polar(c, ro, a1);
|
||||
final Offset fo = polar(c, ro - rc, a1);
|
||||
p.quadraticBezierTo(co.dx, co.dy, fo.dx, fo.dy);
|
||||
final Offset fi = polar(c, ri + rc, a1);
|
||||
p.lineTo(fi.dx, fi.dy);
|
||||
final Offset ci = polar(c, ri, a1);
|
||||
p.quadraticBezierTo(ci.dx, ci.dy, iEnd.dx, iEnd.dy);
|
||||
// 内缘弧(逆时针返回)
|
||||
p.arcToPoint(iStart,
|
||||
radius: Radius.circular(ri), largeArc: span - 2 * dIn > 180, clockwise: false);
|
||||
// 起始端:内角 → 小圆角 → 端面 → 小圆角 → 外角
|
||||
final Offset ci0 = polar(c, ri, a0);
|
||||
final Offset fi0 = polar(c, ri + rc, a0);
|
||||
p.quadraticBezierTo(ci0.dx, ci0.dy, fi0.dx, fi0.dy);
|
||||
final Offset fo0 = polar(c, ro - rc, a0);
|
||||
p.lineTo(fo0.dx, fo0.dy);
|
||||
final Offset co0 = polar(c, ro, a0);
|
||||
p.quadraticBezierTo(co0.dx, co0.dy, oStart.dx, oStart.dy);
|
||||
p.close();
|
||||
return p;
|
||||
}
|
||||
|
||||
/// 绘制圆形视图中的依赖连线。
|
||||
///
|
||||
/// 路径由四段组成:从源弧末端沿半径到中间半径 [rC] → 沿圆弧走到目标弧
|
||||
|
||||
Reference in New Issue
Block a user