aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/views
diff options
context:
space:
mode:
authorGravatar liyuqian <liyuqian@google.com>2016-05-20 07:32:19 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-20 07:32:19 -0700
commite46e4f075bfa8acf038aa68a8e7da282d4c1015b (patch)
treea599a8727b8903da82c1c192323b93def50943f4 /include/views
parent87751127172bd49c632c9290ffde43385d38ce61 (diff)
Correct gesture scale and translation
Diffstat (limited to 'include/views')
-rw-r--r--include/views/SkTouchGesture.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/views/SkTouchGesture.h b/include/views/SkTouchGesture.h
index 60487c7a2f..4d4c0312d3 100644
--- a/include/views/SkTouchGesture.h
+++ b/include/views/SkTouchGesture.h
@@ -43,6 +43,8 @@ public:
const SkMatrix& localM();
const SkMatrix& globalM() const { return fGlobalM; }
+ void setTransLimit(const SkRect& contentRect, const SkRect& windowRect);
+
private:
enum State {
kEmpty_State,
@@ -65,7 +67,11 @@ private:
double fLastUpMillis;
SkPoint fLastUpP;
+ // The following rects are used to limit the translation so the content never leaves the window
+ SkRect fContentRect, fWindowRect;
+ bool fIsTransLimited = false;
+ void limitTrans(); // here we only limit the translation with respect to globalM
void flushLocalM();
int findRec(void* owner) const;
void appendNewRec(void* owner, float x, float y);