void SkView::DoClickUp(Click* click, int x, int y) { SkASSERT(click); SkView* target = (SkView*)SkEventSink::FindSink(click->fTargetID); if (target == NULL) return; click->fIPrev = click->fICurr; click->fICurr.set(x, y); click->fPrev = click->fCurr; click->fCurr.iset(x, y); target->globalToLocal(&click->fCurr); click->fState = Click::kUp_State; target->onClick(click); }
void SkView::DoClickDown(Click* click, int x, int y) { SkASSERT(click); SkView* target = (SkView*)SkEventSink::FindSink(click->fTargetID); if (NULL == target) { return; } click->fIOrig.set(x, y); click->fICurr = click->fIPrev = click->fIOrig; click->fOrig.iset(x, y); if (!target->globalToLocal(&click->fOrig)) { // no history to let us recover from this failure return; } click->fPrev = click->fCurr = click->fOrig; click->fState = Click::kDown_State; target->onClick(click); }
void SkView::DoClickUp(Click* click, int x, int y) { SkASSERT(click); SkView* target = (SkView*)SkEventSink::FindSink(click->fTargetID); if (NULL == target) { return; } click->fIPrev = click->fICurr; click->fICurr.set(x, y); click->fPrev = click->fCurr; click->fCurr.iset(x, y); if (!target->globalToLocal(&click->fCurr)) { // on failure pretend the mouse didn't move click->fCurr = click->fPrev; } click->fState = Click::kUp_State; target->onClick(click); }
void SkView::DoClickMoved(Click* click, int x, int y, unsigned modi) { SkASSERT(click); SkView* target = (SkView*)SkEventSink::FindSink(click->fTargetID); if (nullptr == target) { return; } click->fIPrev = click->fICurr; click->fICurr.set(x, y); click->fPrev = click->fCurr; click->fCurr.iset(x, y); if (!target->globalToLocal(&click->fCurr)) { // on failure pretend the mouse didn't move click->fCurr = click->fPrev; } click->fState = Click::kMoved_State; click->fModifierKeys = modi; target->onClick(click); }