diff --git a/tools/viewer/SkottieSlide.cpp b/tools/viewer/SkottieSlide.cpp index 063330e925..a364bb1099 100644 --- a/tools/viewer/SkottieSlide.cpp +++ b/tools/viewer/SkottieSlide.cpp @@ -77,3 +77,16 @@ bool SkottieSlide::onChar(SkUnichar c) { return INHERITED::onChar(c); } + +bool SkottieSlide::onMouse(SkScalar x, SkScalar y, sk_app::Window::InputState state, uint32_t) { + switch (state) { + case sk_app::Window::kUp_InputState: + fShowAnimationInval = !fShowAnimationInval; + fAnimation->setShowInval(fShowAnimationInval); + break; + default: + break; + } + + return true; +} diff --git a/tools/viewer/SkottieSlide.h b/tools/viewer/SkottieSlide.h index a287a6855c..ac26d2f3c1 100644 --- a/tools/viewer/SkottieSlide.h +++ b/tools/viewer/SkottieSlide.h @@ -27,6 +27,7 @@ public: bool animate(const SkAnimTimer&) override; bool onChar(SkUnichar) override; + bool onMouse(SkScalar x, SkScalar y, sk_app::Window::InputState, uint32_t modifiers) override; private: SkString fPath; diff --git a/tools/viewer/SlideDir.cpp b/tools/viewer/SlideDir.cpp index da8685ddf7..ba3bbbae12 100644 --- a/tools/viewer/SlideDir.cpp +++ b/tools/viewer/SlideDir.cpp @@ -337,8 +337,8 @@ void SlideDir::unload() { } SkISize SlideDir::getDimensions() const { - return SkSize::Make(fWinSize.width(), - fCellSize.height() * (fSlides.count() / fColumns)).toCeil(); + return SkSize::Make(fWinSize.width(), + fCellSize.height() * (1 + (fSlides.count() - 1) / fColumns)).toCeil(); } void SlideDir::draw(SkCanvas* canvas) { @@ -414,5 +414,5 @@ const SlideDir::Rec* SlideDir::findCell(float x, float y) const { row = static_cast(y / fCellSize.height()), idx = row * fColumns + col; - return idx <= fRecs.count() ? &fRecs[idx] : nullptr; + return idx < fRecs.count() ? &fRecs[idx] : nullptr; }