From e46e4f075bfa8acf038aa68a8e7da282d4c1015b Mon Sep 17 00:00:00 2001 From: liyuqian Date: Fri, 20 May 2016 07:32:19 -0700 Subject: Correct gesture scale and translation BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1996613002 Review-Url: https://codereview.chromium.org/1996613002 --- include/views/SkTouchGesture.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/views') 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); -- cgit v1.2.3