Line data Source code
1 : import 'dart:ui' hide Offset; 2 : 3 : import '../../components.dart'; 4 : import '../../geometry.dart'; 5 : import '../anchor.dart'; 6 : import '../extensions/vector2.dart'; 7 : 8 : class ShapeComponent extends PositionComponent { 9 : final Shape shape; 10 : final Paint shapePaint; 11 : 12 1 : ShapeComponent( 13 : this.shape, 14 : this.shapePaint, { 15 : Anchor anchor = Anchor.topLeft, 16 : int? priority, 17 1 : }) : super( 18 1 : position: shape.position, 19 1 : size: shape.size, 20 1 : angle: shape.angle, 21 : anchor: anchor, 22 : priority: priority, 23 : ) { 24 2 : shape.isCanvasPrepared = true; 25 : } 26 : 27 0 : @override 28 : void render(Canvas canvas) { 29 0 : super.render(canvas); 30 0 : shape.render(canvas, shapePaint); 31 : } 32 : 33 0 : @override 34 0 : bool containsPoint(Vector2 point) => shape.containsPoint(point); 35 : }