mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 14:08:28 +00:00
Remove the requirement for autoResize to be set, so anyone can resize a RenderTarget
This commit is contained in:
parent
d4d6a4c308
commit
c81c6cecc8
1 changed files with 6 additions and 15 deletions
|
@ -203,12 +203,16 @@ var RenderTarget = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resizes this Render Target.
|
* Resizes this Render Target as long as the given width and height are different
|
||||||
|
* to the current width and height.
|
||||||
*
|
*
|
||||||
* Deletes both the frame buffer and texture, if they exist and then re-creates
|
* Deletes both the frame buffer and texture, if they exist and then re-creates
|
||||||
* them using the new sizes.
|
* them using the new sizes.
|
||||||
*
|
*
|
||||||
* This method is called automatically by the pipeline during its resize handler.
|
* This method is called automatically by the pipeline during its resize handler.
|
||||||
|
*
|
||||||
|
* Previous to Phaser v3.85 this method would only run if `autoResize` was `true`,
|
||||||
|
* it will now run regardless.
|
||||||
*
|
*
|
||||||
* @method Phaser.Renderer.WebGL.RenderTarget#resize
|
* @method Phaser.Renderer.WebGL.RenderTarget#resize
|
||||||
* @since 3.50.0
|
* @since 3.50.0
|
||||||
|
@ -220,20 +224,7 @@ var RenderTarget = new Class({
|
||||||
*/
|
*/
|
||||||
resize: function (width, height)
|
resize: function (width, height)
|
||||||
{
|
{
|
||||||
width = Math.round(width * this.scale);
|
if (this.willResize(width, height))
|
||||||
height = Math.round(height * this.scale);
|
|
||||||
|
|
||||||
if (width <= 0)
|
|
||||||
{
|
|
||||||
width = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (height <= 0)
|
|
||||||
{
|
|
||||||
height = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.autoResize && (width !== this.width || height !== this.height))
|
|
||||||
{
|
{
|
||||||
var renderer = this.renderer;
|
var renderer = this.renderer;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue