summaryrefslogtreecommitdiff
path: root/libs/input/Input.cpp
diff options
context:
space:
mode:
author chaviw <chaviw@google.com> 2020-07-01 12:37:31 -0700
committer chaviw <chaviw@google.com> 2020-07-14 15:03:07 -0700
commitc01e1379d5d654234861c0881b4d5fb558524f58 (patch)
tree274a20a714ecaecd37220ea00d642c8b90178942 /libs/input/Input.cpp
parent044b4dc70dc1db15da4ee0d4352dd2a940952f14 (diff)
Added helper functions in Transform and PointerCoords
1. Getter for each element in the Transform matrix. 2. Setter for Transform using a nine element array. 3. New multiply in Transform to multiply all elements by a single value 4. transform function in PointerCoords to apply the transform to x and y coordinate Test: Builds Bug: 158476194 Change-Id: Iafe07813c6ce8127875b06e6e6e11554d1862f6f
Diffstat (limited to 'libs/input/Input.cpp')
-rw-r--r--libs/input/Input.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/libs/input/Input.cpp b/libs/input/Input.cpp
index 31aa685391..2ac079ec52 100644
--- a/libs/input/Input.cpp
+++ b/libs/input/Input.cpp
@@ -301,6 +301,11 @@ void PointerCoords::copyFrom(const PointerCoords& other) {
}
}
+void PointerCoords::transform(const ui::Transform& transform) {
+ vec2 newCoords = transform.transform(getX(), getY());
+ setAxisValue(AMOTION_EVENT_AXIS_X, newCoords.x);
+ setAxisValue(AMOTION_EVENT_AXIS_Y, newCoords.y);
+}
// --- PointerProperties ---