apply method
DiagramElement
apply(
- DiagramElement element, {
- DiagramRect? resolvedFrame,
- bool fixTextWidth = false,
Preserve content and bindings while resizing geometry from a frozen scene.
resolvedFrame accounts for auto-grown text bounds at gesture start. It
must come from the same resolved scene as the selection's fromBounds.
fixTextWidth records a horizontal resize as explicit wrapping intent.
Implementation
DiagramElement apply(
DiagramElement element, {
DiagramRect? resolvedFrame,
bool fixTextWidth = false,
}) => switch (element) {
ShapeElement() => element.copyWith(
frame: _mapFrame(resolvedFrame ?? element.frame),
textSizingMode: fixTextWidth
? DiagramTextSizingMode.fixedWidth
: element.textSizingMode,
),
TextElement() => element.copyWith(
frame: _mapFrame(resolvedFrame ?? element.frame),
textSizingMode: fixTextWidth
? DiagramTextSizingMode.fixedWidth
: element.textSizingMode,
),
ConnectorElement() => element.copyWith(
start: _mapEndpoint(element.start),
end: _mapEndpoint(element.end),
routedPoints: const [],
controlPoints: [for (final point in element.controlPoints) point],
),
};