1
0
mirror of https://github.com/psychopy/psychojs.git synced 2025-05-10 18:50:54 +00:00

Merge pull request #509 from lightest/fix_for_backgroundSprite_resize

Fix for backgroundSprite resize
This commit is contained in:
Alain Pitiot 2022-06-17 11:33:01 +02:00 committed by GitHub
commit d88d9963a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,7 +76,7 @@ export class Window extends PsychObject
this._addAttribute("fullscr", fullscr); this._addAttribute("fullscr", fullscr);
this._addAttribute("color", color, new Color("black"), () => { this._addAttribute("color", color, new Color("black"), () => {
if (this._backgroundSprite) { if (this._backgroundSprite) {
this._backgroundSprite.tint = color.int; this._backgroundSprite.tint = this._color.int;
} }
}); });
this._addAttribute("gamma", gamma, 1, () => { this._addAttribute("gamma", gamma, 1, () => {
@ -387,6 +387,7 @@ export class Window extends PsychObject
if (this._renderer) if (this._renderer)
{ {
this._renderer.backgroundColor = this._color.int; this._renderer.backgroundColor = this._color.int;
this._backgroundSprite.tint = this._color.int;
} }
// we also change the background color of the body since // we also change the background color of the body since
@ -508,6 +509,8 @@ export class Window extends PsychObject
this._resizeCallback = (e) => this._resizeCallback = (e) =>
{ {
Window._resizePixiRenderer(this, e); Window._resizePixiRenderer(this, e);
this._backgroundSprite.width = this._size[0];
this._backgroundSprite.height = this._size[1];
this._fullRefresh(); this._fullRefresh();
}; };
window.addEventListener("resize", this._resizeCallback); window.addEventListener("resize", this._resizeCallback);