OLD | NEW |
1 part of sprites; | 1 part of sprites; |
2 | 2 |
3 /// The super class of any [Node] that has a size. | 3 /// The super class of any [Node] that has a size. |
4 /// | 4 /// |
5 /// NodeWithSize adds the ability for a node to have a size and a pivot point. | 5 /// NodeWithSize adds the ability for a node to have a size and a pivot point. |
6 abstract class NodeWithSize extends Node { | 6 abstract class NodeWithSize extends Node { |
7 | 7 |
8 /// Changing the size will affect the size of the rendering of the node. | 8 /// Changing the size will affect the size of the rendering of the node. |
9 /// | 9 /// |
10 /// myNode.size = new Size(1024.0, 1024.0); | 10 /// myNode.size = new Size(1024.0, 1024.0); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 bool isPointInside (Point nodePoint) { | 51 bool isPointInside (Point nodePoint) { |
52 | 52 |
53 double minX = -size.width * pivot.x; | 53 double minX = -size.width * pivot.x; |
54 double minY = -size.height * pivot.y; | 54 double minY = -size.height * pivot.y; |
55 double maxX = minX + size.width; | 55 double maxX = minX + size.width; |
56 double maxY = minY + size.height; | 56 double maxY = minY + size.height; |
57 return (nodePoint.x >= minX && nodePoint.x < maxX && | 57 return (nodePoint.x >= minX && nodePoint.x < maxX && |
58 nodePoint.y >= minY && nodePoint.y < maxY); | 58 nodePoint.y >= minY && nodePoint.y < maxY); |
59 } | 59 } |
60 } | 60 } |
OLD | NEW |