diff options
author | 2018-02-19 13:25:18 -0500 | |
---|---|---|
committer | 2018-02-19 18:43:44 +0000 | |
commit | 65fce9edc44a18e7dc56035cd1bbbd3acc7a7b30 (patch) | |
tree | 20b5a7f558af4d287b1aa49cdaf1754ec51eaa6b /tools/viewer/SlideDir.h | |
parent | cad0acf4db5b03f9b9bf6afedde162fd1c8c4c92 (diff) |
SlideDir focus w/ animation
Add an animated "focus" mode for SlideDir.
Clicking a cell focuses. SPACE unfocuses.
When a slide is focused, mouse and key events are passed through.
TBR=
Change-Id: Iec47e2327e3b21bd626846bb0d3f9107bf680b1b
Reviewed-on: https://skia-review.googlesource.com/108101
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Diffstat (limited to 'tools/viewer/SlideDir.h')
-rw-r--r-- | tools/viewer/SlideDir.h | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/tools/viewer/SlideDir.h b/tools/viewer/SlideDir.h index a4c5f6da0a..f391a24599 100644 --- a/tools/viewer/SlideDir.h +++ b/tools/viewer/SlideDir.h @@ -14,7 +14,12 @@ class SkString; -namespace sksg { class Scene; } +namespace sksg { + +class Group; +class Scene; + +} class SlideDir final : public Slide { public: @@ -34,18 +39,27 @@ protected: bool onMouse(SkScalar x, SkScalar y, sk_app::Window::InputState, uint32_t modifiers) override; private: + struct Rec; + class FocusController; + static constexpr int kDefaultColumnCount = 4; - struct Rec; + const Rec* findCell(float x, float y) const; const SkTArray<sk_sp<Slide>, true> fSlides; + std::unique_ptr<FocusController> fFocusController; const int fColumns; - SkTArray<Rec, true> fRecs; - std::unique_ptr<sksg::Scene> fScene; + SkTArray<Rec, true> fRecs; + std::unique_ptr<sksg::Scene> fScene; + sk_sp<sksg::Group> fRoot; + + SkSize fWinSize = SkSize::MakeEmpty(); + SkSize fCellSize = SkSize::MakeEmpty(); + SkMSec fTimeBase = 0; - SkISize fSize = SkISize::MakeEmpty(); - SkMSec fTimeBase = 0; + const Rec* fTrackingCell = nullptr; + SkPoint fTrackingPos = SkPoint::Make(0, 0); using INHERITED = Slide; }; |