pub fn write_window_touch_events_system(
    mut commands: Commands,
    egui_global_settings: Res<EguiGlobalSettings>,
    hovered_non_window_egui_context: Option<Res<HoveredNonWindowEguiContext>>,
    modifier_keys_state: Res<ModifierKeysState>,
    mut touch_input_reader: EventReader<TouchInput>,
    mut egui_input_event_writer: EventWriter<EguiInputEvent>,
    mut egui_contexts: Query<
        (
            &EguiContextSettings,
            &mut EguiContextPointerPosition,
            &mut EguiContextPointerTouchId,
            &EguiOutput,
        ),
        (With<EguiContext>, With<Window>),
    >,
) {
    let modifiers = modifier_keys_state.to_egui_modifiers();
    for event in touch_input_reader.read() {
        let Some((
            context_settings,
            mut context_pointer_position,
            mut context_pointer_touch_id,
            output,
        )) = egui_contexts.get_some_mut(event.window)
        else {
            continue;
        };

        if egui_global_settings.enable_focused_non_window_context_updates {
            if let bevy_input::touch::TouchPhase::Started = event.phase {
                if let Some(hovered_non_window_egui_context) =
                    hovered_non_window_egui_context.as_deref()
                {
                    if let bevy_input::touch::TouchPhase::Started = event.phase {
                        commands.insert_resource(FocusedNonWindowEguiContext(
                            hovered_non_window_egui_context.0,
                        ));
                    }

                    continue;
                }

                commands.remove_resource::<FocusedNonWindowEguiContext>();
            }
        }

        if !context_settings
            .input_system_settings
            .run_write_window_touch_events_system
        {
            continue;
        }

        let scale_factor = context_settings.scale_factor;
        let touch_position = vec2_into_egui_pos2(event.position / scale_factor);
        context_pointer_position.position = touch_position;
        write_touch_event(
            &mut egui_input_event_writer,
            event,
            event.window,
            output,
            touch_position,
            modifiers,
            &mut context_pointer_touch_id,
        );
    }
}
Reads [`TouchInput`] events and wraps them into [`EguiInputEvent`].
src/input.rs