aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/viewer
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2018-02-01 14:16:54 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-05 15:53:26 +0000
commit8deb295ca7b2b9f6248fef7bb09bbae5df88011b (patch)
treea152353cbbfe7bb96f58eb551af2b5b321ce7d4a /tools/viewer
parent55911313d2d494ecc717e4cef306e0c33a6427fc (diff)
Map Viewer mouse events to Slide space.
There isn't much Slide can do with Window-space mouse events. Change-Id: I36509d4aa1b2ed510b8d8739d39cf5204ad486cc Reviewed-on: https://skia-review.googlesource.com/102149 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'tools/viewer')
-rw-r--r--tools/viewer/Viewer.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index 35b0e146f9..7d69567a29 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -866,9 +866,15 @@ bool Viewer::onMouse(int x, int y, Window::InputState state, uint32_t modifiers)
return false;
}
- if (fSlides[fCurrentSlide]->onMouse(x, y, state, modifiers)) {
- fWindow->inval();
- return true;
+ const auto slideMatrix = this->computeMatrix();
+ SkMatrix slideInvMatrix;
+ if (slideMatrix.invert(&slideInvMatrix)) {
+ SkPoint slideMouse = SkPoint::Make(x, y);
+ slideInvMatrix.mapPoints(&slideMouse, 1);
+ if (fSlides[fCurrentSlide]->onMouse(slideMouse.x(), slideMouse.y(), state, modifiers)) {
+ fWindow->inval();
+ return true;
+ }
}
switch (state) {