addComponent method

void addComponent(
  1. Component component
)

Adds a component to the artboard. Good place for the artboard to check for components it'll later need to do stuff with (like draw them or sort them when the draw order changes).

Implementation

void addComponent(Component component) {
  if (!_components.add(component)) {
    return;
  }
  switch (component.coreType) {
    case NestedArtboardBase.typeKey:
      addNestedArtboard(component as NestedArtboard);
      break;
    case NestedBoolBase.typeKey:
    case NestedNumberBase.typeKey:
    case NestedTriggerBase.typeKey:
      break;
    case JoystickBase.typeKey:
      _joysticks.add(component as Joystick);
      break;
  }
}