drawSelectionIndicator method

void drawSelectionIndicator(
  1. Canvas canvas, {
  2. double highlightOpacity = 0.3,
})

绘制选中状态的视觉反馈

Implementation

void drawSelectionIndicator(Canvas canvas, {double highlightOpacity = 0.3}) {
  if (state != DrawingToolState.selected) return;

  final bounds = getBounds();
  if (bounds.isEmpty) return;

  // 绘制高亮背景
  final highlightPaint = Paint()
    ..color = color.withOpacity(highlightOpacity)
    ..style = PaintingStyle.fill;

  canvas.drawRect(bounds.inflate(3.0), highlightPaint);

  // 绘制选中边框
  final borderPaint = Paint()
    ..color = Colors.white.withOpacity(0.8)
    ..strokeWidth = 1.5
    ..style = PaintingStyle.stroke;

  canvas.drawRect(bounds.inflate(5.0), borderPaint);
}