Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to focus or rename node by double click #7009

Merged
merged 1 commit into from
Nov 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 4 additions & 30 deletions scene/gui/tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2363,19 +2363,11 @@ void Tree::_input_event(InputEvent p_event) {
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE);
warp_mouse(range_drag_capture_pos);
} else {

if (delayed_text_editor) {
uint64_t diff = OS::get_singleton()->get_ticks_msec() - first_selection_time;
if (diff >= 400 && diff <= 800)
edit_selected();
// fast double click
else if (diff < 400) {
emit_signal("item_double_clicked");
}

first_selection_time = OS::get_singleton()->get_ticks_msec();
} else {
Rect2 rect = get_selected()->get_meta("__focus_rect");
if (rect.has_point(Point2(p_event.mouse_button.x,p_event.mouse_button.y))) {
edit_selected();
} else {
emit_signal("item_double_clicked");
}
}
pressing_for_editor=false;
Expand Down Expand Up @@ -2921,8 +2913,6 @@ void Tree::item_selected(int p_column,TreeItem *p_item) {

p_item->cells[p_column].selected=true;
//emit_signal("multi_selected",p_item,p_column,true); - NO this is for TreeItem::select
if (delayed_text_editor)
first_selection_time = OS::get_singleton()->get_ticks_msec();

} else {

Expand Down Expand Up @@ -3572,15 +3562,6 @@ bool Tree::get_allow_rmb_select() const{
}


void Tree::set_delayed_text_editor(bool enabled) {
delayed_text_editor = enabled;
}

bool Tree::is_delayed_text_editor_enabled() const {
return delayed_text_editor;
}


void Tree::_bind_methods() {

ObjectTypeDB::bind_method(_MD("_range_click_timeout"),&Tree::_range_click_timeout);
Expand Down Expand Up @@ -3634,10 +3615,6 @@ void Tree::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_allow_rmb_select","allow"),&Tree::set_allow_rmb_select);
ObjectTypeDB::bind_method(_MD("get_allow_rmb_select"),&Tree::get_allow_rmb_select);

ObjectTypeDB::bind_method(_MD("set_delayed_text_editor","enable"),&Tree::set_delayed_text_editor);
ObjectTypeDB::bind_method(_MD("is_delayed_text_editor_enabled"),&Tree::is_delayed_text_editor_enabled);


ObjectTypeDB::bind_method(_MD("set_single_select_cell_editing_only_when_already_selected","enable"),&Tree::set_single_select_cell_editing_only_when_already_selected);
ObjectTypeDB::bind_method(_MD("get_single_select_cell_editing_only_when_already_selected"),&Tree::get_single_select_cell_editing_only_when_already_selected);

Expand Down Expand Up @@ -3751,9 +3728,6 @@ Tree::Tree() {
force_select_on_already_selected=false;

allow_rmb_select=false;

first_selection_time = 0;
delayed_text_editor = false;
}


Expand Down
6 changes: 0 additions & 6 deletions scene/gui/tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,6 @@ friend class TreeItem;
float last_drag_time;
float time_since_motion;*/

bool delayed_text_editor;
uint64_t first_selection_time;

float drag_speed;
float drag_from;
float drag_accum;
Expand Down Expand Up @@ -537,9 +534,6 @@ friend class TreeItem;

void set_value_evaluator(ValueEvaluator *p_evaluator);

void set_delayed_text_editor(bool enabled);
bool is_delayed_text_editor_enabled() const;

Tree();
~Tree();

Expand Down
1 change: 0 additions & 1 deletion tools/editor/scene_tree_dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2004,7 +2004,6 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelec
scene_tree->connect("nodes_dragged",this,"_nodes_drag_begin");

scene_tree->get_scene_tree()->connect("item_double_clicked", this, "_focus_node");
scene_tree->get_scene_tree()->set_delayed_text_editor(true);

scene_tree->set_undo_redo(&editor_data->get_undo_redo());
scene_tree->set_editor_selection(editor_selection);
Expand Down