isPointInside method
Returns true if the point
is inside the node, the point
is in the
local coordinate system of the node.
myNode.isPointInside(localPoint);
NodeWithSize provides a basic bounding box check for this method, if you require a more detailed check this method can be overridden.
bool isPointInside (Point nodePoint) {
double minX = -size.width * pivot.x;
double minY = -size.height * pivot.y;
double maxX = minX + size.width;
double maxY = minY + size.height;
return (nodePoint.x >= minX && nodePoint.x < maxX &&
nodePoint.y >= minY && nodePoint.y < maxY);
}
Implementation
@override
bool isPointInside(Offset point) {
double minX = -size.width * pivot.dx;
double minY = -size.height * pivot.dy;
double maxX = minX + size.width;
double maxY = minY + size.height;
return (point.dx >= minX &&
point.dx < maxX &&
point.dy >= minY &&
point.dy < maxY);
}