@@ -64,11 +64,6 @@ impl MainWindow {
64
64
// Event consumed by GUI.
65
65
return ;
66
66
}
67
- let height_offset = if self . gui . window ( ) . fullscreen ( ) . is_some ( ) || self . no_gui {
68
- 0.0
69
- } else {
70
- MENU_HEIGHT as f64 * self . gui . window ( ) . scale_factor ( )
71
- } ;
72
67
match event {
73
68
WindowEvent :: CloseRequested => {
74
69
event_loop. exit ( ) ;
@@ -81,7 +76,7 @@ impl MainWindow {
81
76
let viewport_scale_factor = self . gui . window ( ) . scale_factor ( ) ;
82
77
player. set_viewport_dimensions ( ViewportDimensions {
83
78
width : size. width ,
84
- height : size. height . saturating_sub ( height_offset as u32 ) ,
79
+ height : size. height . saturating_sub ( self . gui . height_offset ( ) as u32 ) ,
85
80
scale_factor : viewport_scale_factor,
86
81
} ) ;
87
82
}
@@ -96,10 +91,8 @@ impl MainWindow {
96
91
}
97
92
98
93
self . mouse_pos = position;
99
- let event = PlayerEvent :: MouseMove {
100
- x : position. x ,
101
- y : position. y - height_offset,
102
- } ;
94
+ let ( x, y) = self . gui . window_to_movie_position ( position) ;
95
+ let event = PlayerEvent :: MouseMove { x, y } ;
103
96
self . player . handle_event ( event) ;
104
97
self . check_redraw ( ) ;
105
98
}
@@ -125,8 +118,7 @@ impl MainWindow {
125
118
126
119
use ruffle_core:: events:: MouseButton as RuffleMouseButton ;
127
120
use winit:: event:: MouseButton ;
128
- let x = self . mouse_pos . x ;
129
- let y = self . mouse_pos . y - height_offset;
121
+ let ( x, y) = self . gui . window_to_movie_position ( self . mouse_pos ) ;
130
122
let button = match button {
131
123
MouseButton :: Left => RuffleMouseButton :: Left ,
132
124
MouseButton :: Right => RuffleMouseButton :: Right ,
0 commit comments