https://youtu.be/SgQkKdQqUWo

The problem with the fill. In the background is orange. How to remove it I do not understand. Who faced such a problem?

enter image description here

Here is the code:

public void drawSquare(CanvasPoint center, double dimension, CssColor fillColor) { context2d.beginPath(); context2d.setFillStyle(fillColor); context2d.rect(center.x - dimension / 2, center.y - dimension / 2, dimension, dimension); context2d.fill(); context2d.closePath(); } 

    1 answer 1

    The solution is simple:

    It is necessary to open and close the path when drawing each object.