Exemplo n.º 1
0
bool LifeCell::hitTest(int x, int y)
{
    bool allowsClicksOnComponent, allowsClicksOnChildComponents;                      //temp variables to store clickable state
    getInterceptsMouseClicks(allowsClicksOnComponent, allowsClicksOnChildComponents); //request clickable state and store in temp variables
    
    //if the component is not supposed to receive mouse clicks then return false
    //otherwise pass the hit test into the base classes hit test method
    if (!allowsClicksOnComponent || !allowsClicksOnChildComponents){
        return false;
    }else{
        return ImageButton::hitTest(x, y);
    }
}
Exemplo n.º 2
0
bool DrawableShape::hitTest (int x, int y)
{
    bool allowsClicksOnThisComponent, allowsClicksOnChildComponents;
    getInterceptsMouseClicks (allowsClicksOnThisComponent, allowsClicksOnChildComponents);

    if (! allowsClicksOnThisComponent)
        return false;

    const float globalX = (float) (x - originRelativeToComponent.x);
    const float globalY = (float) (y - originRelativeToComponent.y);

    return path.contains (globalX, globalY)
            || (isStrokeVisible() && strokePath.contains (globalX, globalY));
}