bool Contains( Vector2 localPos )

book_4_sparkGenerated
code_blocksInput

Description

The Contains method determines whether a specified point, given in local coordinates, is within the bounds of the GraphicsItem. This method is useful for hit-testing, allowing you to check if a point, such as a mouse click, is inside the graphical item.

Usage

To use the Contains method, you need to pass a Vector2 representing the local position you want to check. The method returns a Boolean indicating whether the point is inside the GraphicsItem.

Example usage:

GraphicsItem item = new MyGraphicsItem();
Vector2 point = new Vector2(10, 20);
bool isInside = item.Contains(point);
if (isInside)
{
    // The point is within the GraphicsItem
}
else
{
    // The point is outside the GraphicsItem
}

Example

GraphicsItem item = new MyGraphicsItem();
Vector2 point = new Vector2(10, 20);
bool isInside = item.Contains(point);
if (isInside)
{
    // The point is within the GraphicsItem
}
else
{
    // The point is outside the GraphicsItem
}