@@ -257,6 +257,8 @@ Variant ActionMapEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from
257
257
label->set_auto_translate_mode (AUTO_TRANSLATE_MODE_DISABLED);
258
258
action_tree->set_drag_preview (label);
259
259
260
+ get_viewport ()->gui_set_drag_description (vformat (RTR (" Action %s" ), name));
261
+
260
262
Dictionary drag_data;
261
263
262
264
if (selected->has_meta (" __action" )) {
@@ -267,6 +269,8 @@ Variant ActionMapEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from
267
269
drag_data[" input_type" ] = " event" ;
268
270
}
269
271
272
+ drag_data[" source" ] = selected->get_instance_id ();
273
+
270
274
action_tree->set_drop_mode_flags (Tree::DROP_MODE_INBETWEEN);
271
275
272
276
return drag_data;
@@ -278,9 +282,11 @@ bool ActionMapEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_d
278
282
return false ;
279
283
}
280
284
285
+ TreeItem *source = Object::cast_to<TreeItem>(ObjectDB::get_instance (d[" source" ].operator ObjectID ()));
281
286
TreeItem *selected = action_tree->get_selected ();
282
- TreeItem *item = action_tree->get_item_at_position (p_point);
283
- if (!selected || !item || item == selected) {
287
+
288
+ TreeItem *item = (p_point == Vector2 (INFINITY, INFINITY)) ? selected : action_tree->get_item_at_position (p_point);
289
+ if (!selected || !item || item == source) {
284
290
return false ;
285
291
}
286
292
@@ -303,13 +309,13 @@ void ActionMapEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data,
303
309
}
304
310
305
311
TreeItem *selected = action_tree->get_selected ();
306
- TreeItem *target = action_tree->get_item_at_position (p_point);
307
- bool drop_above = action_tree->get_drop_section_at_position (p_point) == -1 ;
308
-
312
+ TreeItem *target = (p_point == Vector2 (INFINITY, INFINITY)) ? selected : action_tree->get_item_at_position (p_point);
309
313
if (!target) {
310
314
return ;
311
315
}
312
316
317
+ bool drop_above = ((p_point == Vector2 (INFINITY, INFINITY)) ? action_tree->get_drop_section_at_position (action_tree->get_item_rect (target).position ) : action_tree->get_drop_section_at_position (p_point)) == -1 ;
318
+
313
319
Dictionary d = p_data;
314
320
if (d[" input_type" ] == " action" ) {
315
321
// Change action order.
@@ -501,8 +507,8 @@ void ActionMapEditor::update_action_list(const Vector<ActionInfo> &p_action_info
501
507
}
502
508
503
509
// Third Column - Buttons
504
- event_item->add_button (2 , action_tree->get_editor_theme_icon (SNAME (" Edit" )), BUTTON_EDIT_EVENT, false , TTR (" Edit Event" ));
505
- event_item->add_button (2 , action_tree->get_editor_theme_icon (SNAME (" Remove" )), BUTTON_REMOVE_EVENT, false , TTR (" Remove Event" ));
510
+ event_item->add_button (2 , action_tree->get_editor_theme_icon (SNAME (" Edit" )), BUTTON_EDIT_EVENT, false , TTR (" Edit Event" ), TTR ( " Edit Event " ) );
511
+ event_item->add_button (2 , action_tree->get_editor_theme_icon (SNAME (" Remove" )), BUTTON_REMOVE_EVENT, false , TTR (" Remove Event" ), TTR ( " Remove Event " ) );
506
512
event_item->set_button_color (2 , 0 , Color (1 , 1 , 1 , 0.75 ));
507
513
event_item->set_button_color (2 , 1 , Color (1 , 1 , 1 , 0.75 ));
508
514
}
@@ -543,13 +549,15 @@ ActionMapEditor::ActionMapEditor() {
543
549
action_list_search = memnew (LineEdit);
544
550
action_list_search->set_h_size_flags (Control::SIZE_EXPAND_FILL);
545
551
action_list_search->set_placeholder (TTR (" Filter by Name" ));
552
+ action_list_search->set_accessibility_name (TTR (" Filter by Name" ));
546
553
action_list_search->set_clear_button_enabled (true );
547
554
action_list_search->connect (SceneStringName (text_changed), callable_mp (this , &ActionMapEditor::_search_term_updated));
548
555
top_hbox->add_child (action_list_search);
549
556
550
557
action_list_search_by_event = memnew (EventListenerLineEdit);
551
558
action_list_search_by_event->set_h_size_flags (Control::SIZE_EXPAND_FILL);
552
559
action_list_search_by_event->set_stretch_ratio (0.75 );
560
+ action_list_search_by_event->set_accessibility_name (TTR (" Action Event" ));
553
561
action_list_search_by_event->connect (" event_changed" , callable_mp (this , &ActionMapEditor::_search_by_event));
554
562
action_list_search_by_event->connect (SceneStringName (focus_entered), callable_mp (this , &ActionMapEditor::_on_filter_focused));
555
563
action_list_search_by_event->connect (SceneStringName (focus_exited), callable_mp (this , &ActionMapEditor::_on_filter_unfocused));
@@ -569,6 +577,7 @@ ActionMapEditor::ActionMapEditor() {
569
577
add_edit = memnew (LineEdit);
570
578
add_edit->set_h_size_flags (Control::SIZE_EXPAND_FILL);
571
579
add_edit->set_placeholder (TTR (" Add New Action" ));
580
+ add_edit->set_accessibility_name (TTR (" Add New Action" ));
572
581
add_edit->set_clear_button_enabled (true );
573
582
add_edit->set_keep_editing_on_text_submit (true );
574
583
add_edit->connect (SceneStringName (text_changed), callable_mp (this , &ActionMapEditor::_add_edit_text_changed));
@@ -597,6 +606,7 @@ ActionMapEditor::ActionMapEditor() {
597
606
// Action Editor Tree
598
607
action_tree = memnew (Tree);
599
608
action_tree->set_v_size_flags (Control::SIZE_EXPAND_FILL);
609
+ action_tree->set_accessibility_name (TTR (" Action Map" ));
600
610
action_tree->set_columns (3 );
601
611
action_tree->set_hide_root (true );
602
612
action_tree->set_column_titles_visible (true );
0 commit comments