On Thu, 1 Aug 2024 11:40:06 GMT, Florian Kirmaier <fkirma...@openjdk.org> wrote:

> Fixing WebView on iOS
> (I couldn't compile it because I don't know how to build it for iOS, but the 
> code should be correct.)
> 
> @johanvos 
> If this looks reasonable to you, can you provide a test build for 
> @dlemmermann ?
> Then he can test it with his JFX-Central iOS version.

For the fix I am adding a listener to the localToSceneTransform property. Every 
time this changes I invoke code to "fix" the location:


     webView.localToSceneTransformProperty().addListener((obs, oldV, newV) -> 
fixIt(view)));


The actual fix is done like this:


    boolean fixing = false;

    private void fixIt(WebView view) {
        if (!fixing) {
            fixing = true;
            view.setLayoutY(view.getLayoutY() + 1);
            double width = view.getWidth();
            double height = view.getHeight();
            view.resize(width + 1, height + 1);
            view.resize(width, height);
            Platform.runLater(() -> fixing = false);
        }
    }

@johanvos @jperedadnr the code can be found in the jfxentral2 repository: 
https://github.com/dlsc-software-consulting-gmbh/jfxcentral2/blob/9f2c50ff54f37c97e2eadef1dbad8dd61d03acc6/components/src/main/java/com/dlsc/jfxcentral2/components/CustomMarkdownView.java#L54

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1526#issuecomment-2416947936
PR Comment: https://git.openjdk.org/jfx/pull/1526#issuecomment-2416952410

Reply via email to