addTableLabelCommand function
AddEntityCommand
addTableLabelCommand(
- DraftDocument doc, {
- required Handle instance,
- required Handle definition,
- required Transform2 placement,
- required String number,
The command that adds number as the label of instance, an instance
of definition placed by placement (T13, T14). Allocates one handle.
Implementation
AddEntityCommand addTableLabelCommand(
DraftDocument doc, {
required Handle instance,
required Handle definition,
required Transform2 placement,
required String number,
}) {
final def = doc.tree.definition(definition);
final top = firstLeafOf(doc, definition);
return AddEntityCommand(
record: tableLabelRecord(
handle: doc.handleSeed.next(), instance: instance, number: number),
payload: tableLabelPayload(
anchor: def?.basePoint ?? Vector2.zero(),
height: top == null
? kTableLabelMaxHeight
: tableLabelHeight(top.kind, top.payload),
placement: placement,
),
);
}