Open thewh1teagle opened 3 months ago
WebviewWindowBuilder::new().position()
expects a LogicalPosition
. Could you try offsetting the position and then convert it to the LogicalPosition
to see if it's correct?
It may look like:
let mut position = window.outer_position().unwrap();
println!("Physical position: {:?}", position);
position.x += 30;
position.y += 30;
let logical_position = position.to_logical::<f64>(window.scale_factor().unwrap());
println!("Logical position: {:?}", &logical_position);
let _window =
WebviewWindowBuilder::new(&app_handle, "main1", WebviewUrl::App("/index.html".into()))
.position(logical_position.x as f64, logical_position.y as f64) // 30px offset x+y
.build();
Describe the bug
I use tauri on v2 project on
macOS
When creating new window with specific position, the position is incorrect and inconsistent comparing of doing it with global tauri.Reproduction
Example on Rust side, it creates the window with invalid offset.
Example correct position using global tauri:
Expected behavior
The window should be created with offset of 30px on x,y
Full
tauri info
outputStack trace
No response
Additional context
window.outer_position
returnsPhysicalPosition<i32>
whileWebviewWindowBuilder::new().position()
expectsf64
window.set_position(position);
right after creating it move it to correct position