Skip to content

Instantly share code, notes, and snippets.

@qiaoshun8888
Created November 4, 2023 23:56
Show Gist options
  • Save qiaoshun8888/b7e9965bcd13b36af3fafc3dcce8afb9 to your computer and use it in GitHub Desktop.
Save qiaoshun8888/b7e9965bcd13b36af3fafc3dcce8afb9 to your computer and use it in GitHub Desktop.
litegraph.extensions.js
/**
* Changes the background color of the canvas.
*
* @method updateBackground
* @param {image} String
* @param {clearBackgroundColor} String
* @
*/
LGraphCanvas.prototype.updateBackground = function (image, clearBackgroundColor) {
this._bg_img = new Image();
this._bg_img.name = image;
this._bg_img.src = image;
this._bg_img.onload = () => {
this.draw(true, true);
};
this.background_image = image;
this.clear_background = true;
this.clear_background_color = clearBackgroundColor;
this._pattern = null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment