support click-drag translate

git-svn-id: http://skia.googlecode.com/svn/trunk@6041 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
mike@reedtribe.org 2012-10-23 03:10:46 +00:00
parent 45ba2f7733
commit c892a153aa

View File

@ -382,13 +382,19 @@ protected:
} else if (fPts[1].equalsWithinTolerance(pt, tol)) {
index = 1;
}
return index >= 0 ? new IndexClick(this, index) : NULL;
return new IndexClick(this, index);
}
virtual bool onClick(Click* click) {
int index = IndexClick::GetIndex(click);
SkASSERT(index >= 0 && index <= 1);
fPts[index] = click->fCurr;
if (index >= 0 && index <= 1) {
fPts[index] = click->fCurr;
} else {
SkScalar dx = click->fCurr.fX - click->fPrev.fX;
SkScalar dy = click->fCurr.fY - click->fPrev.fY;
fPts[0].offset(dx, dy);
fPts[1].offset(dx, dy);
}
this->inval(NULL);
return true;
}