Use send_events instead of send_event in web backend
@@ -137,15 +137,16 @@ impl<T> WindowTarget<T> {
// A mouse down event may come in without any prior CursorMoved events,
// therefore we should send a CursorMoved event to make sure that the
// user code has the correct cursor position.
- runner.send_event(Event::WindowEvent {
+ runner.send_events(
+ std::iter::once(Event::WindowEvent {
window_id: WindowId(id),
event: WindowEvent::CursorMoved {
device_id: DeviceId(device::Id(pointer_id)),
position,
modifiers,
},
- });
- runner.send_event(Event::WindowEvent {
+ })
+ .chain(std::iter::once(Event::WindowEvent {
window_id: WindowId(id),
event: WindowEvent::MouseInput {
device_id: DeviceId(device::Id(pointer_id)),
@@ -153,7 +154,8 @@ impl<T> WindowTarget<T> {
button,
modifiers,
},
- });
+ })),
+ );
});
let runner = self.runner.clone();
