-fix bug in scene tree dragndrop reparenting, closes #4712, closes #4633, closes #4628

-avoid editor scrollable areas to scroll if touchscreen ui hint is turned on
This commit is contained in:
Juan Linietsky 2016-06-18 15:30:44 -03:00
parent adc13e9027
commit 9b9580f568
1 changed files with 27 additions and 12 deletions

View File

@ -1512,14 +1512,20 @@ static bool _has_visible_children(Node* p_node) {
} }
static Node* _find_last_visible(Node*p_node) { static Node* _find_last_visible(Node*p_node) {
Node*last=NULL; Node*last=NULL;
bool collapsed = p_node->has_meta("_editor_collapsed") ? (bool)p_node->get_meta("_editor_collapsed") : false;
if (!collapsed) {
for(int i=0;i<p_node->get_child_count();i++) { for(int i=0;i<p_node->get_child_count();i++) {
if (_is_node_visible(p_node->get_child(i))) { if (_is_node_visible(p_node->get_child(i))) {
last=p_node->get_child(i); last=p_node->get_child(i);
} }
} }
}
if (last) { if (last) {
Node* lastc=_find_last_visible(last); Node* lastc=_find_last_visible(last);
@ -1588,10 +1594,18 @@ void SceneTreeDock::_normalize_drop(Node*& to_node, int &to_pos,int p_type) {
Node* lower_sibling=NULL; Node* lower_sibling=NULL;
if (_has_visible_children(to_node) ) {
to_pos=0;
} else {
for(int i=to_node->get_index()+1;i<to_node->get_parent()->get_child_count();i++) { for(int i=to_node->get_index()+1;i<to_node->get_parent()->get_child_count();i++) {
Node *c =to_node->get_parent()->get_child(i); Node *c =to_node->get_parent()->get_child(i);
if (_is_node_visible(c)) { if (_is_node_visible(c)) {
lower_sibling=c; lower_sibling=c;
break;
} }
} }
@ -1600,6 +1614,7 @@ void SceneTreeDock::_normalize_drop(Node*& to_node, int &to_pos,int p_type) {
} }
to_node=to_node->get_parent(); to_node=to_node->get_parent();
}
#if 0 #if 0
//quite complicated, look for next visible in tree //quite complicated, look for next visible in tree
upper_sibling=_find_last_visible(upper_sibling); upper_sibling=_find_last_visible(upper_sibling);