litegraph.js icon indicating copy to clipboard operation
litegraph.js copied to clipboard

Background turns black when zooming out

Open nene opened this issue 1 year ago • 2 comments

I would like to keep the background a constant color when zooming in/out.

I discovered various issues about the background color. These suggested setting background_image property. This works, but the image still becomes lighter/darker when zoomed.

Another issue suggested setting the background color of the surrounding div. This only seemed to have a mild effect when zooming in. But not at all when zooming out. Here's an example with the surrounding div background set to red:

https://github.com/jagenjo/litegraph.js/assets/118201/09114c68-6628-4813-a412-aa066fa5d1db

I personally also discovered zoom_modify_alpha property. Setting this to false disables the gradual darkening/lightening. But at one point the background simply flips to black. Here's a demonstration of the following settings:

canvas.background_image = "/grid.png"; // non-transparent image
canvas.zoom_modify_alpha = false;

https://github.com/jagenjo/litegraph.js/assets/118201/0ec0d587-db48-4b35-8b70-62e872d3f0c1

More likely though there's something messed up in the surrounding environment where I'm using litegraph... this project I'm working with is such a mess :(

nene avatar Apr 11 '24 11:04 nene

same here

suhli avatar May 21 '24 01:05 suhli

could try canvas.clear_background_color = "#FFF"; (haven't tried myself)

atlasan avatar May 28 '24 19:05 atlasan