mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-25 05:07:12 +01:00
Don't handle pending clicks outside scene tree
(cherry picked from commit ec6bbd486f31245af3764c466431ffc2d13d52ed)
This commit is contained in:
parent
3659429afd
commit
24a7bbc9ea
@ -108,11 +108,19 @@ void SceneTreeDock::_quick_open() {
|
|||||||
void SceneTreeDock::_input(Ref<InputEvent> p_event) {
|
void SceneTreeDock::_input(Ref<InputEvent> p_event) {
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
|
|
||||||
if (pending_click_select && mb.is_valid() && !mb->is_pressed() && (mb->get_button_index() == BUTTON_LEFT || mb->get_button_index() == BUTTON_RIGHT)) {
|
if (mb.is_valid() && (mb->get_button_index() == BUTTON_LEFT || mb->get_button_index() == BUTTON_RIGHT)) {
|
||||||
|
if (mb->is_pressed() && scene_tree->get_rect().has_point(mb->get_position())) {
|
||||||
|
tree_clicked = true;
|
||||||
|
} else if (!mb->is_pressed()) {
|
||||||
|
tree_clicked = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mb->is_pressed() && pending_click_select) {
|
||||||
_push_item(pending_click_select);
|
_push_item(pending_click_select);
|
||||||
pending_click_select = nullptr;
|
pending_click_select = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SceneTreeDock::_unhandled_key_input(Ref<InputEvent> p_event) {
|
void SceneTreeDock::_unhandled_key_input(Ref<InputEvent> p_event) {
|
||||||
ERR_FAIL_COND(p_event.is_null());
|
ERR_FAIL_COND(p_event.is_null());
|
||||||
@ -1461,10 +1469,10 @@ void SceneTreeDock::_push_item(Object *p_object) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SceneTreeDock::_handle_select(Node *p_node) {
|
void SceneTreeDock::_handle_select(Node *p_node) {
|
||||||
if ((Input::get_singleton()->get_mouse_button_mask() & (BUTTON_MASK_LEFT | BUTTON_MASK_RIGHT)) != 0) {
|
if (tree_clicked) {
|
||||||
pending_click_select = p_node;
|
pending_click_select = p_node;
|
||||||
} else {
|
} else {
|
||||||
editor->push_item(p_node);
|
_push_item(p_node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3294,6 +3302,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
|
|||||||
editor_selection = p_editor_selection;
|
editor_selection = p_editor_selection;
|
||||||
scene_root = p_scene_root;
|
scene_root = p_scene_root;
|
||||||
pending_click_select = nullptr;
|
pending_click_select = nullptr;
|
||||||
|
tree_clicked = false;
|
||||||
|
|
||||||
VBoxContainer *vbc = this;
|
VBoxContainer *vbc = this;
|
||||||
|
|
||||||
|
@ -192,6 +192,7 @@ class SceneTreeDock : public VBoxContainer {
|
|||||||
Node *edited_scene;
|
Node *edited_scene;
|
||||||
Node *pending_click_select;
|
Node *pending_click_select;
|
||||||
EditorNode *editor;
|
EditorNode *editor;
|
||||||
|
bool tree_clicked;
|
||||||
|
|
||||||
VBoxContainer *create_root_dialog;
|
VBoxContainer *create_root_dialog;
|
||||||
String selected_favorite_root;
|
String selected_favorite_root;
|
||||||
|
Loading…
Reference in New Issue
Block a user