copyArtboard method

void copyArtboard(
  1. ActorArtboard artboard
)

Implementation

void copyArtboard(ActorArtboard artboard) {
  _name = artboard._name;
  Vec2D.copy(_translation, artboard._translation);
  _width = artboard._width;
  _height = artboard._height;
  Vec2D.copy(_origin, artboard._origin);
  _clipContents = artboard._clipContents;

  _color[0] = artboard._color[0];
  _color[1] = artboard._color[1];
  _color[2] = artboard._color[2];
  _color[3] = artboard._color[3];

  //_actor = artboard._actor;
  _animations = artboard._animations;
  _drawableNodeCount = artboard._drawableNodeCount;
  _nodeCount = artboard._nodeCount;

  if (artboard.componentCount != 0) {
    _components = <ActorComponent?>[];
  }
  if (_nodeCount != 0) // This will always be at least 1.
  {
    _nodes = List<ActorNode?>.filled(_nodeCount, null);
  }

  if (artboard.componentCount != 0) {
    for (final ActorComponent? component in artboard.components) {
      _components.add(component?.makeInstance(this));
    }
  }
  // Copy dependency order.
  _dependencyOrder =
      List<ActorComponent?>.filled(artboard._dependencyOrder!.length, null);
  for (final ActorComponent? component in artboard._dependencyOrder!) {
    final ActorComponent localComponent = _components[component!.idx]!;
    _dependencyOrder![component.graphOrder] = localComponent;
    localComponent.dirtMask = 255;
  }

  _flags |= ActorFlags.isDirty;
  _root = _components[0]! as ActorNode;
  resolveHierarchy();
  completeResolveHierarchy();
}