addShape method

bool addShape(
  1. XmlStartElementEvent event
)

Appends a DrawableShape to the currentGroup.

Implementation

bool addShape(XmlStartElementEvent event) {
  final _PathFunc? pathFunc = _svgPathFuncs[event.name];
  if (pathFunc == null) {
    return false;
  }

  final DrawableParent parent = _parentDrawables.last.drawable!;
  final DrawableStyle? parentStyle = parent.style;
  final Path path = pathFunc(this)!;
  final DrawableStyleable drawable = DrawableShape(
    getAttribute(attributes, 'id', def: ''),
    path,
    parseStyle(
      path.getBounds(),
      parentStyle,
      defaultFillColor: colorBlack,
      currentColor: parent.color,
    ),
    transform: parseTransform(getAttribute(attributes, 'transform'))?.storage,
  );
  checkForIri(drawable);
  parent.children!.add(drawable);
  return true;
}