Repository: godotengine/godot
File: editor/plugins/node_3d_editor_plugin.cpp (C++)

Code before:
		} else if (m->get_button_mask().has_flag(MouseButtonMask::LEFT)) {
			if (nav_scheme == NAVIGATION_MAYA && m->is_alt_pressed()) {
				nav_mode = NAVIGATION_ORBIT;
			} else if (nav_scheme == NAVIGATION_MODO && m->is_alt_pressed() && m->is_shift_pressed()) {
				nav_mode = NAVIGATION_PAN;
			} else if (nav_scheme == NAVIGATION_MODO && m->is_alt_pressed() && m->is_command_or_control_pressed()) {
				nav_mode = NAVIGATION_ZOOM;
			} else if (nav_scheme == NAVIGATION_MODO && m->is_alt_pressed()) {
				nav_mode = NAVIGATION_ORBIT;
			} else {
				const bool movement_threshold_passed = _edit.original_mouse_pos.distance_to(_edit.mouse_pos) > 8 * EDSCALE;

				if (selection_in_progress && movement_threshold_passed && clicked.is_valid()) {
					if (clicked_wants_append || !editor_selection->is_selected(Object::cast_to<Node>(ObjectDB::get_instance(clicked)))) {
						cursor.region_select = true;
						cursor.region_begin = _edit.original_mouse_pos;
						clicked = ObjectID();
					}
				}

				if (cursor.region_select) {
					cursor.region_end = m->get_position();
					surface->queue_redraw();
					return;
				}

				if (clicked.is_valid() && movement_threshold_passed) {
					_compute_edit(_edit.original_mouse_pos);
					clicked = ObjectID();
					_edit.mode = TRANSFORM_TRANSLATE;
				}

				if (_edit.mode == TRANSFORM_NONE || _edit.numeric_input != 0 || _edit.numeric_next_decimal != 0) {
					return;
				}

				update_transform(_get_key_modifier(m) == Key::SHIFT);
			}
		} else if (m->get_button_mask().has_flag(MouseButtonMask::RIGHT) || freelook_active) {
			if (nav_scheme == NAVIGATION_MAYA && m->is_alt_pressed()) {
				nav_mode = NAVIGATION_ZOOM;
			} else if (freelook_active) {
				nav_mode = NAVIGATION_LOOK;
			} else if (orthogonal) {
				nav_mode = NAVIGATION_PAN;
			}

		} else if (m->get_button_mask().has_flag(MouseButtonMask::MIDDLE)) {
			const Key mod = _get_key_modifier(m);
			if (nav_scheme == NAVIGATION_GODOT) {
				if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier")) {

Review comment (suggestion):
```suggestion
			if (zoom_mod_pressed && (!_is_shortcut_empty("spatial_editor/viewport_zoom_modifier_1") || !_is_shortcut_empty("spatial_editor/viewport_zoom_modifier_2"))) {
				nav_mode = NAVIGATION_ZOOM;
			} else if (pan_mod_pressed && (!_is_shortcut_empty("spatial_editor/viewport_pan_modifier_1") || !_is_shortcut_empty("spatial_editor/viewport_pan_modifier_2"))) {
				nav_mode = NAVIGATION_PAN;
			} else if (orbit_mod_pressed && (!_is_shortcut_empty("spatial_editor/viewport_orbit_modifier_1") || !_is_shortcut_empty("spatial_editor/viewport_orbit_modifier_2"))) {
```
Cheaper condition first

Code after:

				seg->handles_intersect_ray(camera, _edit.mouse_pos, false, found_handle, found_handle_secondary);

				if (found_handle != -1) {
					found_gizmo = seg;
					break;
				}
			}

			if (found_gizmo.is_valid()) {
				spatial_editor->select_gizmo_highlight_axis(-1);
			}

			bool current_hover_handle_secondary = false;
			int curreny_hover_handle = spatial_editor->get_current_hover_gizmo_handle(current_hover_handle_secondary);
			if (found_gizmo != spatial_editor->get_current_hover_gizmo() || found_handle != curreny_hover_handle || found_handle_secondary != current_hover_handle_secondary) {
				spatial_editor->set_current_hover_gizmo(found_gizmo);
				spatial_editor->set_current_hover_gizmo_handle(found_handle, found_handle_secondary);
				spatial_editor->get_single_selected_node()->update_gizmos();
			}
		}

		if (spatial_editor->get_current_hover_gizmo().is_null() && !m->get_button_mask().has_flag(MouseButtonMask::LEFT) && !_edit.gizmo.is_valid()) {
			_transform_gizmo_select(_edit.mouse_pos, true);
		}

		NavigationMode nav_mode = NAVIGATION_NONE;

		if (_edit.gizmo.is_valid()) {
			_edit.gizmo->set_handle(_edit.gizmo_handle, _edit.gizmo_handle_secondary, camera, m->get_position());
			Variant v = _edit.gizmo->get_handle_value(_edit.gizmo_handle, _edit.gizmo_handle_secondary);
			String n = _edit.gizmo->get_handle_name(_edit.gizmo_handle, _edit.gizmo_handle_secondary);
			set_message(n + ": " + String(v));

		} else if (m->get_button_mask().has_flag(MouseButtonMask::LEFT)) {
			NavigationMode change_nav_from_shortcut = _get_nav_mode_from_shortcut_check(NAVIGATION_LEFT_MOUSE, shortcut_check_sets, false);
			if (change_nav_from_shortcut != NAVIGATION_NONE) {
				nav_mode = change_nav_from_shortcut;
			} else {
				const bool movement_threshold_passed = _edit.original_mouse_pos.distance_to(_edit.mouse_pos) > 8 * EDSCALE;

				if (selection_in_progress && movement_threshold_passed && clicked.is_valid()) {
					if (clicked_wants_append || !editor_selection->is_selected(Object::cast_to<Node>(ObjectDB::get_instance(clicked)))) {
						cursor.region_select = true;
						cursor.region_begin = _edit.original_mouse_pos;
						clicked = ObjectID();
					}
				}

				if (cursor.region_select) {
					cursor.region_end = m->get_position();