updateToolProperties method

void updateToolProperties(
  1. String id,
  2. Map<String, dynamic> properties
)

Implementation

void updateToolProperties(String id, Map<String, dynamic> properties) {
  final tool = _tools.firstWhere((t) => t.id == id);

  if (properties.containsKey('color')) {
    tool.color = properties['color'];
  }
  if (properties.containsKey('strokeWidth')) {
    tool.strokeWidth = properties['strokeWidth'];
  }

  // 特定工具的属性更新
  switch (tool.type) {
    case DrawingToolType.trendLine:
    case DrawingToolType.trendAngle:
    case DrawingToolType.arrow:
    case DrawingToolType.verticalLine:
    case DrawingToolType.horizontalLine:
    case DrawingToolType.horizontalRay:
    case DrawingToolType.ray:
    case DrawingToolType.crossLine:
      // 这些工具类型不需要特殊属性更新
      break;
  }

  _notifyToolsChanged();
}