From 3d2891a224befac40cd07fbd09b7678cae1ade50 Mon Sep 17 00:00:00 2001 From: Nathan Sweet Date: Sun, 20 Jun 2021 15:13:41 -0400 Subject: [PATCH] [ts] Player, set bg color on player div, not parent. --- spine-ts/player/src/Player.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spine-ts/player/src/Player.ts b/spine-ts/player/src/Player.ts index 5075744ae..e6bf93570 100644 --- a/spine-ts/player/src/Player.ts +++ b/spine-ts/player/src/Player.ts @@ -210,10 +210,6 @@ module spine { this.bgFullscreen.setFromString(config.fullScreenBackgroundColor); this.parent.appendChild(this.create()); - if (!config.alpha) { // Prevents a flash before the first frame is drawn. - let hex = config.backgroundColor; - this.parent.style.backgroundColor = (hex.charAt(0) == '#' ? hex : "#" + hex).substr(0, 7); - } // Register a global resize handler to redraw, avoiding flicker. window.addEventListener("resize", () => this.drawFrame(false)); @@ -264,6 +260,11 @@ module spine { let dom = this.dom = createElement( /*html*/`
${controls}
`); + if (!config.alpha) { // Prevents a flash before the first frame is drawn. + let hex = config.backgroundColor; + this.dom.style.backgroundColor = (hex.charAt(0) == '#' ? hex : "#" + hex).substr(0, 7); + } + try { // Setup the OpenGL context. this.canvas = findWithClass(dom, "spine-player-canvas") as HTMLCanvasElement;