From 9f3afafb294f657568bea683a30d14632d76b9b4 Mon Sep 17 00:00:00 2001 From: Zeke Chan Date: Mon, 2 Sep 2024 13:58:15 +0800 Subject: [PATCH] Fix #6885 leave fullscreen event fires twice --- src/scale/ScaleManager.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/scale/ScaleManager.js b/src/scale/ScaleManager.js index 0a765768d..0eba1271c 100644 --- a/src/scale/ScaleManager.js +++ b/src/scale/ScaleManager.js @@ -1438,7 +1438,6 @@ var ScaleManager = new Class({ * Calling this method will cancel fullscreen mode, if the browser has entered it. * * @method Phaser.Scale.ScaleManager#stopFullscreen - * @fires Phaser.Scale.Events#LEAVE_FULLSCREEN * @fires Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED * @since 3.16.0 */ @@ -1459,7 +1458,18 @@ var ScaleManager = new Class({ } this.removeFullscreenTarget(); + }, + /** + * The browser has successfully left fullscreen mode. + * + * @method Phaser.Scale.ScaleManager#leaveFullScreenSuccessHandler + * @fires Phaser.Scale.Events#LEAVE_FULLSCREEN + * @fires Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED + * @since 3.85.0 + */ + leaveFullScreenSuccessHandler: function () + { // Get the parent size again as it will have changed this.getParentBounds(); @@ -1582,6 +1592,7 @@ var ScaleManager = new Class({ { // They pressed ESC while in fullscreen mode this.stopFullscreen(); + this.leaveFullScreenSuccessHandler(); } },