mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 21:53:59 +00:00
The EXPAND
Scale Mode would cause the error "Framebuffer status: Incomplete Attachment" under WebGL if the Phaser game loaded into an iframe or element with a size of 0 on either axis, such as when you load the game into a 0x0 iframe before expanding it. It now protects against divide by zero errors.
This commit is contained in:
parent
c6caba7598
commit
72e2857882
1 changed files with 7 additions and 7 deletions
|
@ -431,12 +431,14 @@ var ScaleManager = new Class({
|
|||
|
||||
this.fullscreen = game.device.fullscreen;
|
||||
|
||||
if ((this.scaleMode !== CONST.SCALE_MODE.RESIZE) && (this.scaleMode !== CONST.SCALE_MODE.EXPAND))
|
||||
var scaleMode = this.scaleMode;
|
||||
|
||||
if (scaleMode !== CONST.SCALE_MODE.RESIZE && scaleMode !== CONST.SCALE_MODE.EXPAND)
|
||||
{
|
||||
this.displaySize.setAspectMode(this.scaleMode);
|
||||
this.displaySize.setAspectMode(scaleMode);
|
||||
}
|
||||
|
||||
if (this.scaleMode === CONST.SCALE_MODE.NONE)
|
||||
if (scaleMode === CONST.SCALE_MODE.NONE)
|
||||
{
|
||||
this.resize(this.width, this.height);
|
||||
}
|
||||
|
@ -1104,18 +1106,16 @@ var ScaleManager = new Class({
|
|||
style.width = styleWidth + 'px';
|
||||
style.height = styleHeight + 'px';
|
||||
|
||||
|
||||
// Expand canvas size to fit game size's width or height
|
||||
|
||||
var scaleX = this.parentSize.width / baseWidth;
|
||||
|
||||
var scaleY = this.parentSize.height / baseHeight;
|
||||
|
||||
if (scaleX < scaleY)
|
||||
if (scaleX < scaleY && scaleX !== 0)
|
||||
{
|
||||
this.baseSize.setSize(baseWidth, this.parentSize.height / scaleX);
|
||||
}
|
||||
else
|
||||
else if (scaleY !== 0)
|
||||
{
|
||||
this.baseSize.setSize(this.displaySize.width / scaleY, baseHeight);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue