Remove the requirement for autoResize to be set, so anyone can resize a RenderTarget

This commit is contained in:
Richard Davey 2024-08-06 18:58:12 +01:00
parent d4d6a4c308
commit c81c6cecc8

View file

@ -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
* them using the new sizes.
*
* 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
* @since 3.50.0
@ -220,20 +224,7 @@ var RenderTarget = new Class({
*/
resize: function (width, height)
{
width = Math.round(width * this.scale);
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))
if (this.willResize(width, height))
{
var renderer = this.renderer;