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>
This commit is contained in:
Florin Malita 2018-02-01 14:16:54 -05:00 committed by Skia Commit-Bot
parent 55911313d2
commit 8deb295ca7

View File

@ -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) {