StrokeNode.fromWorldPoints constructor
StrokeNode.fromWorldPoints({ - required NodeId id,
- required List<Offset> points,
- required double thickness,
- required Color color,
- double hitPadding = 0,
- double opacity = 1,
- bool isVisible = true,
- bool isSelectable = true,
- bool isLocked = false,
- bool isDeletable = true,
- bool isTransformable = true,
})
Implementation
factory StrokeNode.fromWorldPoints({
required NodeId id,
required List<Offset> points,
required double thickness,
required Color color,
double hitPadding = 0,
double opacity = 1,
bool isVisible = true,
bool isSelectable = true,
bool isLocked = false,
bool isDeletable = true,
bool isTransformable = true,
}) {
final bounds = points.isEmpty ? Rect.zero : aabbFromPoints(points);
final centerWorld = bounds.center;
final local = points.map((p) => p - centerWorld).toList(growable: false);
return StrokeNode(
id: id,
points: local,
thickness: thickness,
color: color,
hitPadding: hitPadding,
transform: Transform2D.translation(centerWorld),
opacity: opacity,
isVisible: isVisible,
isSelectable: isSelectable,
isLocked: isLocked,
isDeletable: isDeletable,
isTransformable: isTransformable,
);
}