tableEdgeCapacities function
Implementation
List<int> tableEdgeCapacities(LayoutNode table) {
if (table.kind != 'table' ||
isBarNode(table) ||
[
'polygon',
'grid',
'round',
'circle',
'ellipse',
'oval',
].contains(table.surface?['type'] ?? table.properties['shape'])) {
throw ArgumentError('Edge seating requires a rectangular table');
}
final seating = TableSeating.fromTable(table),
inset = seating.edgePadding * 2,
allowance = seating.edgePadding == 0 ? seating.spacing : 0.0;
int capacity(double length) =>
max(0, ((length - inset + allowance) / seating.pitch).floor());
return [
capacity(table.width),
capacity(table.height),
capacity(table.width),
capacity(table.height),
];
}