Example #1
0
bool UICurvePoint::HitTest(const STPoint2& position)
{
    UIRectangle r = UIRectangle(STPoint2(m_point->mCoordinates.x+-gPointSize, m_point->mCoordinates.y+-gPointSize),
                                STPoint2(m_point->mCoordinates.x+ gPointSize, m_point->mCoordinates.y+ gPointSize));
    if(r.Contains(position))
        return true;
    
    return false;
}
Example #2
0
void UIDraggableBox::HandleMouseMove(const STPoint2& position)
{
    MouseState state = CurrentMouseState();
    if (state == OVER || state == DOWN)
    {
        STVector2 diff = GetRectangle().pMax - GetRectangle().pMin;
        STPoint2 lowerLeft = position - mRelativeMousePosition;
        SetRectangle(UIRectangle(lowerLeft, lowerLeft + diff));
    }
}