pub fn write_mouse_wheel_events_system(
    modifier_keys_state: Res<ModifierKeysState>,
    hovered_non_window_egui_context: Option<Res<HoveredNonWindowEguiContext>>,
    mut mouse_wheel_reader: EventReader<MouseWheel>,
    mut egui_input_event_writer: EventWriter<EguiInputEvent>,
    egui_contexts: Query<&EguiContextSettings, With<EguiContext>>,
) {
    let modifiers = modifier_keys_state.to_egui_modifiers();
    for event in mouse_wheel_reader.read() {
        let delta = egui::vec2(event.x, event.y);
        let unit = match event.unit {
            MouseScrollUnit::Line => egui::MouseWheelUnit::Line,
            MouseScrollUnit::Pixel => egui::MouseWheelUnit::Point,
        };

        let context = hovered_non_window_egui_context
            .as_deref()
            .map_or(event.window, |hovered| hovered.0);

        let Some(context_settings) = egui_contexts.get_some(context) else {
            continue;
        };

        if !context_settings
            .input_system_settings
            .run_write_mouse_wheel_events_system
        {
            continue;
        }

        egui_input_event_writer.write(EguiInputEvent {
            context,
            event: egui::Event::MouseWheel {
                unit,
                delta,
                modifiers,
            },
        });
    }
}
Reads [`MouseWheel`] events and wraps them into [`EguiInputEvent`], can redirect events to [`HoveredNonWindowEguiContext`].
src/input.rs