textFor method

DiagramTextDefinition textFor(
  1. DiagramElement? owner, {
  2. String? slotId,
})

The text filling slotId of owner: a shape's text part or table cell, a standalone text element's region or a connector's labels.

Implementation

DiagramTextDefinition textFor(DiagramElement? owner, {String? slotId}) =>
    switch (owner) {
      ShapeElement(:final type, :final textStory) => require(
        type,
      ).textFor(slotId ?? TextRole.body.name, textStory),
      TextElement(:final type) => requireText(
        type,
      ).textFor(slotId ?? TextRole.body.name),
      ConnectorElement() =>
        connectorFor(owner).labeling?.textType ?? const PlainTextDefinition(),
      _ => const PlainTextDefinition(),
    };