Commit f99b0b8 1 parent b999d9f commit f99b0b8 Copy full SHA for f99b0b8
File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -1221,13 +1221,14 @@ fn is_mobile() -> Option<bool> {
1221
1221
// On mobile devices, there is no need to do that.
1222
1222
fn move_text_cursor ( cursor : & Option < egui:: Pos2 > , canvas_id : & str ) -> Option < ( ) > {
1223
1223
let style = text_agent ( ) . style ( ) ;
1224
- let rect = text_agent ( ) . get_bounding_client_rect ( ) ;
1225
1224
// Note: movint agent on mobile devices will lead to unpredictable scroll.
1226
1225
if is_mobile ( ) == Some ( false ) {
1227
1226
cursor. as_ref ( ) . and_then ( |& egui:: Pos2 { x, y } | {
1228
1227
let canvas = canvas_element ( canvas_id) ?;
1229
- let y = ( y + ( canvas. scroll_top ( ) + canvas. offset_top ( ) ) as f32 )
1230
- . min ( canvas. client_height ( ) as f32 - rect. height ( ) as f32 ) ;
1228
+ let y = ( y + ( canvas. scroll_top ( ) + canvas. offset_top ( ) ) as f32 ) . min (
1229
+ canvas. client_height ( ) as f32
1230
+ - text_agent ( ) . get_bounding_client_rect ( ) . height ( ) as f32 ,
1231
+ ) ;
1231
1232
let x = x + ( canvas. scroll_left ( ) + canvas. offset_left ( ) ) as f32 ;
1232
1233
// Canvas is translated 50% horizontally in html.
1233
1234
let x = x - canvas. offset_width ( ) as f32 / 2.0 ;
You can’t perform that action at this time.
0 commit comments