diff options
author | Brian Salomon <bsalomon@google.com> | 2018-01-05 11:58:16 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-01-05 18:18:39 +0000 |
commit | 88d99df31f4c181b926c61204abf61df9e4960b6 (patch) | |
tree | 2af138ec61d60d37e513e3ffad8aa6afea272a69 | |
parent | 4a577af2d8b177fef873acdfc1915e4f09e3614d (diff) |
[Viewer] Preserve gesture transformation matrix on slide/backend change
Change-Id: I417fb9b6d6b7c95884dff6871731883fe3736437
Reviewed-on: https://skia-review.googlesource.com/91460
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
-rw-r--r-- | include/views/SkTouchGesture.h | 1 | ||||
-rw-r--r-- | src/views/SkTouchGesture.cpp | 8 | ||||
-rw-r--r-- | tools/viewer/Viewer.cpp | 2 |
3 files changed, 8 insertions, 3 deletions
diff --git a/include/views/SkTouchGesture.h b/include/views/SkTouchGesture.h index faadfc1b3d..82f59f2862 100644 --- a/include/views/SkTouchGesture.h +++ b/include/views/SkTouchGesture.h @@ -36,6 +36,7 @@ public: void touchMoved(void* owner, float x, float y); void touchEnd(void* owner); void reset(); + void resetTouchState(); bool isActive() { return fFlinger.isActive(); } void stop() { fFlinger.stop(); } diff --git a/src/views/SkTouchGesture.cpp b/src/views/SkTouchGesture.cpp index dbcec511b7..4dce06a6f3 100644 --- a/src/views/SkTouchGesture.cpp +++ b/src/views/SkTouchGesture.cpp @@ -108,17 +108,21 @@ SkTouchGesture::SkTouchGesture() { SkTouchGesture::~SkTouchGesture() { } -void SkTouchGesture::reset() { +void SkTouchGesture::resetTouchState() { fIsTransLimited = false; fTouches.reset(); fState = kEmpty_State; fLocalM.reset(); - fGlobalM.reset(); fLastUpMillis = SkTime::GetMSecs() - 2*MAX_DBL_TAP_INTERVAL; fLastUpP.set(0, 0); } +void SkTouchGesture::reset() { + fGlobalM.reset(); + this->resetTouchState(); +} + void SkTouchGesture::flushLocalM() { fGlobalM.postConcat(fLocalM); fLocalM.reset(); diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp index 55a025c1ed..68f8a8d4e5 100644 --- a/tools/viewer/Viewer.cpp +++ b/tools/viewer/Viewer.cpp @@ -614,7 +614,7 @@ void Viewer::setupCurrentSlide(int previousSlide) { // prepare dimensions for image slides fSlides[fCurrentSlide]->load(SkIntToScalar(fWindow->width()), SkIntToScalar(fWindow->height())); - fGesture.reset(); + fGesture.resetTouchState(); fDefaultMatrix.reset(); const SkISize slideSize = fSlides[fCurrentSlide]->getDimensions(); |