diff options
| author | Poommetee Ketson | 2018-02-24 10:25:50 +0700 |
|---|---|---|
| committer | Hein-Pieter van Braam | 2018-02-27 17:52:18 +0100 |
| commit | 17408bea9c8c69da3d7548e6b9bc8198217717d2 (patch) | |
| tree | 1316a93f16af3fdc180fc9dad55771c7a1f4e9a3 | |
| parent | 2c55064708f3f281bb94ea3cb622684a90547c4f (diff) | |
| download | godot-17408bea9c8c69da3d7548e6b9bc8198217717d2.tar.gz godot-17408bea9c8c69da3d7548e6b9bc8198217717d2.tar.zst godot-17408bea9c8c69da3d7548e6b9bc8198217717d2.zip | |
(Magnify|Pan)Gesture: implement as_text
(cherry picked from commit 67e20dc2b6167e6dd9cb05056fd82de71891395f)
| -rw-r--r-- | core/os/input_event.cpp | 10 | ||||
| -rw-r--r-- | core/os/input_event.h | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp index 12060f31d..b9607632f 100644 --- a/core/os/input_event.cpp +++ b/core/os/input_event.cpp @@ -962,6 +962,11 @@ Ref<InputEvent> InputEventMagnifyGesture::xformed_by(const Transform2D &p_xform, return ev; } +String InputEventMagnifyGesture::as_text() const { + + return "InputEventMagnifyGesture : factor=" + rtos(get_factor()) + ", position=(" + String(get_position()) + ")"; +} + void InputEventMagnifyGesture::_bind_methods() { ClassDB::bind_method(D_METHOD("set_factor", "factor"), &InputEventMagnifyGesture::set_factor); @@ -999,6 +1004,11 @@ Ref<InputEvent> InputEventPanGesture::xformed_by(const Transform2D &p_xform, con return ev; } +String InputEventPanGesture::as_text() const { + + return "InputEventPanGesture : delta=(" + String(get_delta()) + "), position=(" + String(get_position()) + ")"; +} + void InputEventPanGesture::_bind_methods() { ClassDB::bind_method(D_METHOD("set_delta", "delta"), &InputEventPanGesture::set_delta); diff --git a/core/os/input_event.h b/core/os/input_event.h index ad754d0d1..0a33ab18a 100644 --- a/core/os/input_event.h +++ b/core/os/input_event.h @@ -494,6 +494,7 @@ public: real_t get_factor() const; virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const; + virtual String as_text() const; InputEventMagnifyGesture(); }; @@ -511,6 +512,7 @@ public: Vector2 get_delta() const; virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const; + virtual String as_text() const; InputEventPanGesture(); }; |
