MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / _root_window_input

Method _root_window_input

scene/debugger/scene_debugger.cpp:1651–1717  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1649}
1650
1651void RuntimeNodeSelect::_root_window_input(const Ref<InputEvent> &p_event) {
1652 Window *root = SceneTree::get_singleton()->get_root();
1653 if (node_select_type == NODE_TYPE_NONE || (selection_list && selection_list->is_visible())) {
1654 // Workaround for platforms that don't allow subwindows.
1655 if (selection_list && selection_list->is_visible() && selection_list->is_embedded()) {
1656 root->set_disable_input_override(false);
1657 selection_list->push_input(p_event);
1658 callable_mp(root->get_viewport(), &Viewport::set_disable_input_override).call_deferred(true);
1659 }
1660
1661 return;
1662 }
1663
1664 bool is_dragging_camera = false;
1665 if (camera_override) {
1666 if (node_select_type == NODE_TYPE_2D) {
1667 is_dragging_camera = panner->gui_input(p_event, Rect2(Vector2(), root->get_visible_rect().get_size()));
1668#ifndef _3D_DISABLED
1669 } else if (node_select_type == NODE_TYPE_3D && selection_drag_state == SELECTION_DRAG_NONE) {
1670 if (_handle_3d_input(p_event)) {
1671 return;
1672 }
1673#endif // _3D_DISABLED
1674 }
1675 }
1676
1677 Ref<InputEventMouseButton> b = p_event;
1678
1679 if (selection_drag_state == SELECTION_DRAG_MOVE) {
1680 Ref<InputEventMouseMotion> m = p_event;
1681 if (m.is_valid()) {
1682 _update_selection_drag(root->get_screen_transform().affine_inverse().xform(m->get_position()));
1683 return;
1684 } else if (b.is_valid()) {
1685 // Account for actions like zooming.
1686 _update_selection_drag(root->get_screen_transform().affine_inverse().xform(b->get_position()));
1687 }
1688 }
1689
1690 if (b.is_null()) {
1691 return;
1692 }
1693
1694 // Ignore mouse wheel inputs.
1695 if (b->get_button_index() != MouseButton::LEFT && b->get_button_index() != MouseButton::RIGHT) {
1696 return;
1697 }
1698
1699 if (selection_drag_state == SELECTION_DRAG_MOVE && !b->is_pressed() && b->get_button_index() == MouseButton::LEFT) {
1700 selection_drag_state = SELECTION_DRAG_END;
1701 selection_drag_area = selection_drag_area.abs();
1702 _update_selection_drag();
1703
1704 // Trigger a selection in the position on release.
1705 if (multi_shortcut_pressed) {
1706 selection_position = root->get_screen_transform().affine_inverse().xform(b->get_position());
1707 }
1708 }

Callers

nothing calls this directly

Calls 15

is_embeddedMethod · 0.80
push_inputMethod · 0.80
get_visible_rectMethod · 0.80
get_button_indexMethod · 0.80
is_shift_pressedMethod · 0.80
is_alt_pressedMethod · 0.80
Rect2Class · 0.50
Vector2Function · 0.50
get_rootMethod · 0.45
is_visibleMethod · 0.45
call_deferredMethod · 0.45

Tested by

no test coverage detected