diff --git a/project/scenes/editor.tscn b/project/scenes/editor.tscn index 2240c075..9fac213f 100644 --- a/project/scenes/editor.tscn +++ b/project/scenes/editor.tscn @@ -63,26 +63,32 @@ func _ready(): func _unhandled_input(event: InputEvent) -> void: if event is InputEventMouseButton and (event as InputEventMouseButton).button_index == MOUSE_BUTTON_RIGHT: get_viewport().set_input_as_handled() + get_viewport().gui_release_focus() rotating = event.is_pressed() elif event is InputEventMouseButton and (event as InputEventMouseButton).button_index == MOUSE_BUTTON_MIDDLE: get_viewport().set_input_as_handled() + get_viewport().gui_release_focus() panning = event.is_pressed() elif event is InputEventMouseMotion and rotating: get_viewport().set_input_as_handled() + get_viewport().gui_release_focus() var motion := event as InputEventMouseMotion global_position += (global_basis.y * motion.screen_relative.y - global_basis.x * motion.screen_relative.x) * rotate_speed * distance look_at(pivot) global_position = (global_position - pivot).normalized() * distance + pivot elif event is InputEventMouseButton and (event as InputEventMouseButton).button_index == MOUSE_BUTTON_WHEEL_UP: get_viewport().set_input_as_handled() + get_viewport().gui_release_focus() distance = max(1., distance - zoom_speed) global_position = (global_position - pivot).normalized() * distance + pivot elif event is InputEventMouseButton and (event as InputEventMouseButton).button_index == MOUSE_BUTTON_WHEEL_DOWN: get_viewport().set_input_as_handled() + get_viewport().gui_release_focus() distance = min(1000., distance + zoom_speed) global_position = (global_position - pivot).normalized() * distance + pivot elif event is InputEventMouseMotion and panning: get_viewport().set_input_as_handled() + get_viewport().gui_release_focus() var backward := Vector3(global_basis.z.x, 0.0, global_basis.z.z).normalized() var right := Vector3(global_basis.x.x, 0.0, global_basis.x.z).normalized() var motion := event as InputEventMouseMotion