summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/input/Input.h1
-rw-r--r--libs/input/Input.cpp5
2 files changed, 6 insertions, 0 deletions
diff --git a/include/input/Input.h b/include/input/Input.h
index e778076..be79c59 100644
--- a/include/input/Input.h
+++ b/include/input/Input.h
@@ -184,6 +184,7 @@ struct PointerCoords {
status_t setAxisValue(int32_t axis, float value);
void scale(float scale);
+ void applyOffset(float xOffset, float yOffset);
inline float getX() const {
return getAxisValue(AMOTION_EVENT_AXIS_X);
diff --git a/libs/input/Input.cpp b/libs/input/Input.cpp
index 6f53996..ccbf52b 100644
--- a/libs/input/Input.cpp
+++ b/libs/input/Input.cpp
@@ -213,6 +213,11 @@ void PointerCoords::scale(float scaleFactor) {
scaleAxisValue(*this, AMOTION_EVENT_AXIS_TOOL_MINOR, scaleFactor);
}
+void PointerCoords::applyOffset(float xOffset, float yOffset) {
+ setAxisValue(AMOTION_EVENT_AXIS_X, getX() + xOffset);
+ setAxisValue(AMOTION_EVENT_AXIS_Y, getY() + yOffset);
+}
+
#ifdef HAVE_ANDROID_OS
status_t PointerCoords::readFromParcel(Parcel* parcel) {
bits = parcel->readInt64();