@ -297,7 +297,7 @@ pub(crate) fn install_canvas_events(runner_ref: &WebRunner) -> Result<(), JsValu
let modifiers = modifiers_from_mouse_event ( & event ) ;
runner . input . raw . modifiers = modifiers ;
if let Some ( button ) = button_from_mouse_event ( & event ) {
let pos = pos_from_mouse_event ( runner . canvas ( ) , & event ) ;
let pos = pos_from_mouse_event ( runner . canvas ( ) , & event , runner . egui_ctx ( ) ) ;
let modifiers = runner . input . raw . modifiers ;
runner . input . raw . events . push ( egui ::Event ::PointerButton {
pos ,
@ -324,7 +324,7 @@ pub(crate) fn install_canvas_events(runner_ref: &WebRunner) -> Result<(), JsValu
| event : web_sys ::MouseEvent , runner | {
let modifiers = modifiers_from_mouse_event ( & event ) ;
runner . input . raw . modifiers = modifiers ;
let pos = pos_from_mouse_event ( runner . canvas ( ) , & event ) ;
let pos = pos_from_mouse_event ( runner . canvas ( ) , & event , runner . egui_ctx ( ) ) ;
runner . input . raw . events . push ( egui ::Event ::PointerMoved ( pos ) ) ;
runner . needs_repaint . repaint_asap ( ) ;
event . stop_propagation ( ) ;
@ -336,7 +336,7 @@ pub(crate) fn install_canvas_events(runner_ref: &WebRunner) -> Result<(), JsValu
let modifiers = modifiers_from_mouse_event ( & event ) ;
runner . input . raw . modifiers = modifiers ;
if let Some ( button ) = button_from_mouse_event ( & event ) {
let pos = pos_from_mouse_event ( runner . canvas ( ) , & event ) ;
let pos = pos_from_mouse_event ( runner . canvas ( ) , & event , runner . egui_ctx ( ) ) ;
let modifiers = runner . input . raw . modifiers ;
runner . input . raw . events . push ( egui ::Event ::PointerButton {
pos ,
@ -374,7 +374,12 @@ pub(crate) fn install_canvas_events(runner_ref: &WebRunner) -> Result<(), JsValu
"touchstart" ,
| event : web_sys ::TouchEvent , runner | {
let mut latest_touch_pos_id = runner . input . latest_touch_pos_id ;
let pos = pos_from_touch_event ( runner . canvas ( ) , & event , & mut latest_touch_pos_id ) ;
let pos = pos_from_touch_event (
runner . canvas ( ) ,
& event ,
& mut latest_touch_pos_id ,
runner . egui_ctx ( ) ,
) ;
runner . input . latest_touch_pos_id = latest_touch_pos_id ;
runner . input . latest_touch_pos = Some ( pos ) ;
let modifiers = runner . input . raw . modifiers ;
@ -397,7 +402,12 @@ pub(crate) fn install_canvas_events(runner_ref: &WebRunner) -> Result<(), JsValu
"touchmove" ,
| event : web_sys ::TouchEvent , runner | {
let mut latest_touch_pos_id = runner . input . latest_touch_pos_id ;
let pos = pos_from_touch_event ( runner . canvas ( ) , & event , & mut latest_touch_pos_id ) ;
let pos = pos_from_touch_event (
runner . canvas ( ) ,
& event ,
& mut latest_touch_pos_id ,
runner . egui_ctx ( ) ,
) ;
runner . input . latest_touch_pos_id = latest_touch_pos_id ;
runner . input . latest_touch_pos = Some ( pos ) ;
runner . input . raw . events . push ( egui ::Event ::PointerMoved ( pos ) ) ;
@ -460,7 +470,9 @@ pub(crate) fn install_canvas_events(runner_ref: &WebRunner) -> Result<(), JsValu
} ) ;
let scroll_multiplier = match unit {
egui ::MouseWheelUnit ::Page = > canvas_size_in_points ( runner . canvas ( ) ) . y ,
egui ::MouseWheelUnit ::Page = > {
canvas_size_in_points ( runner . canvas ( ) , runner . egui_ctx ( ) ) . y
}
egui ::MouseWheelUnit ::Line = > {
#[ allow(clippy::let_and_return) ]
let points_per_scroll_line = 8.0 ; // Note that this is intentionally different from what we use in winit.