Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Manual WebView resizing does not work correctly #10053

Closed
kanatapple opened this issue Jun 13, 2024 · 6 comments · Fixed by tauri-apps/wry#1299
Closed

[bug] Manual WebView resizing does not work correctly #10053

kanatapple opened this issue Jun 13, 2024 · 6 comments · Fixed by tauri-apps/wry#1299
Labels
scope: unstable flag Issue only occures with "unstable" feature flag enabled status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@kanatapple
Copy link
Contributor

Describe the bug

Manually resizing the WebView(set_size) results in incorrect positioning of the WebView.
However, if the WebView coordinates are set to (0., 0.), it works correctly.

https://youtu.be/02gJWTb1Hjg

Reproduction

https://github.com/kanatapple/tauri-manual-resize

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.19045 X64
    ✔ WebView2: 125.0.2535.92
    ✔ MSVC:
        - Visual Studio Professional 2017
        - Visual Studio Professional 2019
    ✔ rustc: 1.77.2 (25ef9e3d8 2024-04-09)
    ✔ cargo: 1.77.2 (e52e36006 2024-03-26)
    ✔ rustup: 1.27.0 (bbb9276d2 2024-03-08)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 20.11.0
    - yarn: 1.22.11
    - npm: 10.2.4

[-] Packages
    - tauri [RUST]: 2.0.0-beta.22
    - tauri-build [RUST]: 2.0.0-beta.17
    - wry [RUST]: 0.40.1
    - tao [RUST]: 0.28.1
    - tauri-cli [RUST]: 1.2.3
    - @tauri-apps/api [NPM]: 2.0.0-beta.13
    - @tauri-apps/cli [NPM]: 2.0.0-beta.20

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http:https://localhost:1420/
    - bundler: Vite

Stack trace

No response

Additional context

No response

@kanatapple kanatapple added status: needs triage This issue needs to triage, applied to new issues type: bug labels Jun 13, 2024
@kanatapple kanatapple changed the title [bug] Manually resize WebView [bug] Manual WebView resizing does not work correctly Jun 13, 2024
@FabianLars FabianLars added the scope: unstable flag Issue only occures with "unstable" feature flag enabled label Jun 13, 2024
@kanatapple
Copy link
Contributor Author

If the initial position is (1, 1) and scale_factor is 1.5 (150%), the position becomes (2, 2) in set_bounds .
In bounds.position.to_physical it becomes (1.5, 1.5), but it is cast to (2, 2).

After that, the position seems to increase from (2, 2) -> (3, 3), (3, 3) -> (5, 5), and so on.

@kanatapple
Copy link
Contributor Author

kanatapple commented Jun 20, 2024

Now that I know the cause, I'll send a Pull Request later.

@happybeing
Copy link

happybeing commented Jun 30, 2024

I have a similar issue with my app. Whatever values I use, my Webview fills the bottom half of the app window.

I reported this and @FabianLars responded that it might be related to this issue.

So I cloned the repo from the OP. In that case the Webview fills the whole app Window whatever I do with the commented out code.

No matter what I do I don't seem able to affect the position / size / behaviour of the Webview in the OP example or my app. This fits with my not understanding how the multiwebview example is achieving it's layout. I don't see how that can divide the vertical space equally between (four I think) Webviews, nor how it results in them taking up the full width.

A good place to start for me would be for the multiwebview example to be explained (and fixed first if indeed it is buggy, which seems to be the case).

[✔] Environment
    - OS: Ubuntu 24.4.0 X64
    ✔ webkit2gtk-4.1: 2.44.0
    ✔ rsvg2: 2.58.0
    ✔ rustc: 1.79.0 (129f3b996 2024-06-10)
    ✔ cargo: 1.79.0 (ffa9cf99a 2024-06-03)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (environment override by RUSTUP_TOOLCHAIN)
    - node: 22.1.0
    - yarn: 1.22.22
    - npm: 10.7.0

[-] Packages
    - tauri [RUST]: 2.0.0-beta.22
    - tauri-build [RUST]: 2.0.0-beta.17
    - wry [RUST]: 0.40.1
    - tao [RUST]: 0.28.1
    - tauri-cli [RUST]: 2.0.0-beta.20
    - @tauri-apps/api [NPM]: 2.0.0-beta.13
    - @tauri-apps/cli [NPM]: 2.0.0-beta.20

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http:https://localhost:1420/
    - bundler: Vite

@hattapoglu
Copy link

I have a similar issue. Updating webview size using set_size causes cumulative positioning on Windows devices where it works perfect on Mac devices. Following here..

@kanatapple
Copy link
Contributor Author

@happybeing @hattapoglu
wry is fixed, so this issue should be fixed soon(Not sure if it's the same cause... 😅 )

@happybeing
Copy link

Yeh, thanks. I suspect not based on the symptoms and the strangeness I see in the example - how does that work? I shall take a another look before long.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: unstable flag Issue only occures with "unstable" feature flag enabled status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants