PositionComponent constructor
PositionComponent({})
Implementation
PositionComponent({
Vector2? position,
Vector2? size,
Vector2? scale,
double? angle,
this.nativeAngle = 0,
Anchor? anchor,
super.children,
super.priority,
super.key,
}) : transform = Transform2D(),
_anchor = anchor ?? Anchor.topLeft,
_size = NotifyingVector2.copy(size ?? Vector2.zero()) {
decorator = Transform2DDecorator(transform);
if (position != null) {
transform.position = position;
}
if (angle != 0) {
transform.angle = angle ?? 0;
}
if (scale != null) {
transform.scale = scale;
}
_size.addListener(_onModifiedSizeOrAnchor);
_onModifiedSizeOrAnchor();
}