1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

It is now possible to cancel on 2D polygon editor. RMB (previously close) and ESC will cancel polygon. Closes #15474

This commit is contained in:
Juan Linietsky
2018-11-13 18:50:54 -03:00
parent 65111ba996
commit 7f347cc31a
2 changed files with 16 additions and 1 deletions

View File

@@ -229,6 +229,18 @@ void AbstractPolygon2DEditor::_wip_changed() {
}
}
void AbstractPolygon2DEditor::_wip_cancel() {
wip.clear();
wip_active = false;
edited_point = PosVertex();
hover_point = Vertex();
selected_point = Vertex();
canvas_item_editor->update_viewport();
}
void AbstractPolygon2DEditor::_wip_close() {
if (!wip_active)
return;
@@ -429,7 +441,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
}
}
} else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && wip_active) {
_wip_close();
_wip_cancel();
}
}
}
@@ -510,6 +522,8 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
} else if (wip_active && k->get_scancode() == KEY_ENTER) {
_wip_close();
} else if (wip_active && k->get_scancode() == KEY_ESCAPE) {
_wip_cancel();
}
}