Merge pull request #16970 from Noshyaar/inp

(Magnify|Pan)Gesture: implement as_text
This commit is contained in:
Rémi Verschelde 2018-02-24 10:55:03 +01:00 committed by GitHub
commit 36285cd82f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

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

View File

@ -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();
};