tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
81.61k stars 2.44k forks source link

[bug] cannot fix the position of a webview and set auto_resize at the same time #9611

Open sebhernandezr opened 4 months ago

sebhernandezr commented 4 months ago

Describe the bug

I create a webview and add it to my main window. I set a LogicalPosition to be cero in the horizontal axis, and an offset in the vertical axis. Finally I set auto_resize. With this config, the webview is not fixed on the vertical axis as I resize the window. However, If I remove the auto_resize, the webview is now fixed.

window.add_child(
    WebviewBuilder::new(label, WebviewUrl::External(url)).auto_resize(), 
    LogicalPosition::new(0, offset),
    window.inner_size().unwrap(),
)

Reproduction

No response

Expected behavior

Webview position should be fixed in the vertical axis and it is resizable.

Full tauri info output

[✔] Environment
    - OS: Mac OS 14.3.1 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.76.0 (07dca489a 2024-02-04)
    ✔ cargo: 1.76.0 (c84b36747 2024-01-18)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 18.20.2
    - pnpm: 9.0.2
    - npm: 10.5.0

[-] Packages
    - tauri [RUST]: 2.0.0-beta.15
    - tauri-build [RUST]: 2.0.0-beta.12
    - wry [RUST]: 0.39.1
    - tao [RUST]: 0.27.0
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli [NPM]: 2.0.0-beta.1

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../../dist/apps/exam-web
    - devUrl: http://localhost:3000/
    - framework: React
    - bundler: Vite

Stack trace

No response

Additional context

auto_resize: https://github.com/tauri-apps/tauri/assets/46209454/833ce09d-d2c2-46ff-928f-3620ee5604e3

No auto_resize: https://github.com/tauri-apps/tauri/assets/46209454/bd06caa4-ede7-415d-a0b3-736287add084

oddpxl commented 3 months ago

I have the same problem. @seb-hernandez did you manage to find a solution ?

sebhernandezr commented 1 month ago

@oddpxl not yet. I actually gave this issue low prio on my project bc it seams that it's not as important to Tauri team. I just have tried using LogicalPosition and PhisicalPosition but I have the same behavior. Maybe we need to push a bit on Tauri team or find a way to fix it ourselves.