JPro-one / JPro

The right place to report about bugs or suggest improvements for JPro.
https://www.jpro.one
9 stars 4 forks source link

Canvas is suddenly blank after selecting other tabs in the browser #176

Open pabulaner opened 4 months ago

pabulaner commented 4 months ago

We encountered an issue with the canvas being rendered. Because if You render something on the canvas inside JPro and then select some other tabs in the browser and then go back to Your JPro tab, the canvas is blank.

Setup:

To reproduce just run the following code inside JPro and Chromium:

package com.example;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.layout.BorderPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;

public class App extends Application {
    @Override
    public void start(Stage primaryStage) {
        BorderPane root = new BorderPane();

        Canvas canvas = new Canvas(800, 600);
        root.setCenter(canvas);

        GraphicsContext gc = canvas.getGraphicsContext2D();
        gc.setFill(Color.RED);
        gc.fillRect(50, 50, 100, 100);

        primaryStage.setScene(new Scene(root, 800, 600));
        primaryStage.show();
    }
}

If the tab opens in the browser You should see a red rectangle. If You now have at least four other tabs open and click them one after another and then go back to Your JPro application, the canvas is blank.

FlorianKirmaier commented 4 months ago

Hi @pabulaner

We tried a lot of devices, but we can't reproduce it.

Can you try this version? 2024.2.2-CANVAS_FIX.pom If it works, I'll add the fix to the next version. Otherwise, please contact me by email so we can have a quick meeting. Which should be enough to fix this problem.

pabulaner commented 4 months ago

Hey, so I tried it with the jpro-plugin versoin "2024.2.2-CANVAS_FIX" and it still is blank after selecting other tabs.