Пример #1
0
SkView::Click* SkView::findClickHandler(SkScalar x, SkScalar y, unsigned modi) {
    if (x < 0 || y < 0 || x >= fWidth || y >= fHeight) {
        return nullptr;
    }

    if (this->onSendClickToChildren(x, y, modi)) {
        F2BIter    iter(this);
        SkView*    child;

        while ((child = iter.next()) != nullptr)
        {
            SkPoint p;
            if (!child->globalToLocal(x, y, &p)) {
                continue;
            }

            Click* click = child->findClickHandler(p.fX, p.fY, modi);

            if (click) {
                return click;
            }
        }
    }

    return this->onFindClickHandler(x, y, modi);
}
Пример #2
0
SkView::Click* SkView::findClickHandler(SkScalar x, SkScalar y, unsigned modi) {
    if (x < 0 || y < 0 || x >= fWidth || y >= fHeight) {
        return nullptr;
    }

    if (this->onSendClickToChildren(x, y, modi)) {
        F2BIter    iter(this);
        SkView*    child;

        while ((child = iter.next()) != nullptr) {
            SkPoint p;
#if 0
            if (!child->globalToLocal(x, y, &p)) {
                continue;
            }
#else
            // the above seems broken, so just respecting fLoc for now <reed>
            p.set(x - child->fLoc.x(), y - child->fLoc.y());
#endif

            Click* click = child->findClickHandler(p.fX, p.fY, modi);

            if (click) {
                return click;
            }
        }
    }

    return this->onFindClickHandler(x, y, modi);
}
Пример #3
0
SkView::Click* SkView::findClickHandler(SkScalar x, SkScalar y)
{
	if (x < 0 || y < 0 || x >= fWidth || y >= fHeight) {
		return false;
    }

    if (this->onSendClickToChildren(x, y)) {
        F2BIter	iter(this);
        SkView*	child;

        while ((child = iter.next()) != NULL)
        {
            Click* click = child->findClickHandler(x - child->fLoc.fX,
                                                   y - child->fLoc.fY);
            if (click) {
                return click;
            }
        }
    }
	return this->onFindClickHandler(x, y);
}