You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Window spawns in top left corner. I want my window be centered on screen. How do i make it spawn centered on screen?
I thought about manually centering window, but i haven't found a way to get screen resolution. Also i heard that wayland does not let you know your screen resolution.
The text was updated successfully, but these errors were encountered:
The problem is getting the screen size in a cross-platform way.
If the target platform is not webASM then you could use orbclient::get_display_size()
in one of your widget's state init method(), ask the entity of the window with
let window = ctx.window();// get the window position property, maybe not like this, i cant recall exactly nowlet window_x = ctx.widget(window).get("position").clone().x();let window_x = ctx.widget(window).get("position").clone().y();
then
match orbclient::get_display_size(){Ok(screen_size) => {self.x = (screen_size.0 - window_width) / 2;self.y = (screen_size.1 - window_height) / 2;/// set window's positon property values of x and y}Err(msg) => {eprintln!("Cannot determine screen size: {}", msg);}
Window spawns in top left corner. I want my window be centered on screen. How do i make it spawn centered on screen?
I thought about manually centering window, but i haven't found a way to get screen resolution. Also i heard that wayland does not let you know your screen resolution.
The text was updated successfully, but these errors were encountered: