File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -124,11 +124,14 @@ pub fn ui_focus_system(
124124 } )
125125 . filter_map ( |window_id| windows. get ( window_id) )
126126 . filter ( |window| window. is_focused ( ) )
127- . find_map ( |window| window. cursor_position ( ) )
127+ . find_map ( |window| {
128+ window. cursor_position ( ) . map ( |mut cursor_pos| {
129+ cursor_pos. y = window. height ( ) - cursor_pos. y ;
130+ cursor_pos
131+ } )
132+ } )
128133 . or_else ( || touches_input. first_pressed_position ( ) ) ;
129134
130- let window_height = windows. primary ( ) . height ( ) ;
131-
132135 // prepare an iterator that contains all the nodes that have the cursor in their rect,
133136 // from the top node to the bottom one. this will also reset the interaction to `None`
134137 // for all nodes encountered that are no longer hovered.
@@ -167,7 +170,7 @@ pub fn ui_focus_system(
167170 // clicking
168171 let contains_cursor = if let Some ( cursor_position) = cursor_position {
169172 ( min. x ..max. x ) . contains ( & cursor_position. x )
170- && ( min. y ..max. y ) . contains ( & ( window_height - cursor_position. y ) )
173+ && ( min. y ..max. y ) . contains ( & cursor_position. y )
171174 } else {
172175 false
173176 } ;
You can’t perform that action at this time.
0 commit comments