mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Add double_tap attribute to InputEventScreenTouch
This provides parity with the `InputEventMouseButton` allowing for proper conversion between the two events.
This commit is contained in:
@@ -934,6 +934,13 @@ bool InputEventScreenTouch::is_pressed() const {
|
||||
return pressed;
|
||||
}
|
||||
|
||||
void InputEventScreenTouch::set_double_tap(bool p_double_tap) {
|
||||
double_tap = p_double_tap;
|
||||
}
|
||||
bool InputEventScreenTouch::is_double_tap() const {
|
||||
return double_tap;
|
||||
}
|
||||
|
||||
Ref<InputEvent> InputEventScreenTouch::xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs) const {
|
||||
Ref<InputEventScreenTouch> st;
|
||||
st.instance();
|
||||
@@ -941,12 +948,13 @@ Ref<InputEvent> InputEventScreenTouch::xformed_by(const Transform2D &p_xform, co
|
||||
st->set_index(index);
|
||||
st->set_position(p_xform.xform(pos + p_local_ofs));
|
||||
st->set_pressed(pressed);
|
||||
st->set_double_tap(double_tap);
|
||||
|
||||
return st;
|
||||
}
|
||||
|
||||
String InputEventScreenTouch::as_text() const {
|
||||
return "InputEventScreenTouch : index=" + itos(index) + ", pressed=" + (pressed ? "true" : "false") + ", position=(" + String(get_position()) + ")";
|
||||
return "InputEventScreenTouch : index=" + itos(index) + ", pressed=" + (pressed ? "true" : "false") + ", position=(" + String(get_position()) + "), double_tap=" + (double_tap ? "true" : "false");
|
||||
}
|
||||
|
||||
void InputEventScreenTouch::_bind_methods() {
|
||||
@@ -959,14 +967,19 @@ void InputEventScreenTouch::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_pressed", "pressed"), &InputEventScreenTouch::set_pressed);
|
||||
//ClassDB::bind_method(D_METHOD("is_pressed"),&InputEventScreenTouch::is_pressed);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_double_tap", "double_tap"), &InputEventScreenTouch::set_double_tap);
|
||||
ClassDB::bind_method(D_METHOD("is_double_tap"), &InputEventScreenTouch::is_double_tap);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "index"), "set_index", "get_index");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "position"), "set_position", "get_position");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "pressed"), "set_pressed", "is_pressed");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "double_tap"), "set_double_tap", "is_double_tap");
|
||||
}
|
||||
|
||||
InputEventScreenTouch::InputEventScreenTouch() {
|
||||
index = 0;
|
||||
pressed = false;
|
||||
double_tap = false;
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user