OLD | NEW |
1 part of sprites; | 1 part of sprites; |
2 | 2 |
3 /// Options for setting up a [SpriteBox]. | 3 /// Options for setting up a [SpriteBox]. |
4 /// | 4 /// |
5 /// * [nativePoints], use the same points as the parent [Widget]. | 5 /// * [nativePoints], use the same points as the parent [Widget]. |
6 /// * [letterbox], use the size of the root node for the coordinate system, con
strain the aspect ratio and trim off | 6 /// * [letterbox], use the size of the root node for the coordinate system, con
strain the aspect ratio and trim off |
7 /// areas that end up outside the screen. | 7 /// areas that end up outside the screen. |
8 /// * [stretch], use the size of the root node for the coordinate system, scale
it to fit the size of the box. | 8 /// * [stretch], use the size of the root node for the coordinate system, scale
it to fit the size of the box. |
9 /// * [scaleToFit], similar to the letterbox option, but instead of trimming ar
eas the sprite system will be scaled | 9 /// * [scaleToFit], similar to the letterbox option, but instead of trimming ar
eas the sprite system will be scaled |
10 /// down to fit the box. | 10 /// down to fit the box. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 } | 77 } |
78 | 78 |
79 // Properties | 79 // Properties |
80 | 80 |
81 /// The root node of the node tree that is rendered by this box. | 81 /// The root node of the node tree that is rendered by this box. |
82 /// | 82 /// |
83 /// var rootNode = mySpriteBox.rootNode; | 83 /// var rootNode = mySpriteBox.rootNode; |
84 NodeWithSize get rootNode => _rootNode; | 84 NodeWithSize get rootNode => _rootNode; |
85 | 85 |
86 void performLayout() { | 86 void performLayout() { |
87 size = constraints.constrain(Size.infinite); | 87 size = constraints.biggest; |
88 _invalidateTransformMatrix(); | 88 _invalidateTransformMatrix(); |
89 _callSpriteBoxPerformedLayout(_rootNode); | 89 _callSpriteBoxPerformedLayout(_rootNode); |
90 } | 90 } |
91 | 91 |
92 // Event handling | 92 // Event handling |
93 | 93 |
94 void _addEventTargets(Node node, List<Node> eventTargets) { | 94 void _addEventTargets(Node node, List<Node> eventTargets) { |
95 List children = node.children; | 95 List children = node.children; |
96 int i = 0; | 96 int i = 0; |
97 | 97 |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 /// | 371 /// |
372 /// if (event.pointer == firstPointerId) { | 372 /// if (event.pointer == firstPointerId) { |
373 /// // Do something | 373 /// // Do something |
374 /// } | 374 /// } |
375 final int pointer; | 375 final int pointer; |
376 | 376 |
377 /// Creates a new SpriteBoxEvent, typically this is done internally inside the
SpriteBox. | 377 /// Creates a new SpriteBoxEvent, typically this is done internally inside the
SpriteBox. |
378 /// | 378 /// |
379 /// var event = new SpriteBoxEvent(new Point(50.0, 50.0), 'pointerdown', 0
); | 379 /// var event = new SpriteBoxEvent(new Point(50.0, 50.0), 'pointerdown', 0
); |
380 SpriteBoxEvent(this.boxPosition, this.type, this.pointer); | 380 SpriteBoxEvent(this.boxPosition, this.type, this.pointer); |
381 } | 381 } |
OLD | NEW |