resolveWithElement static method

void resolveWithElement(
  1. Object o,
  2. PCanvasElement element
)

Implementation

static void resolveWithElement(Object o, PCanvasElement element) {
  if (o is WithElement) {
    o.element ??= element;
  }

  if (o is WithParentElement &&
      o.parent == null &&
      element is PCanvasElement2D) {
    var p = element.parent;
    if (p is PCanvasElement) {
      o.parent = p as PCanvasElement;
    }
  }
}