From 8a52c00cad471684ca55da5d78a182f7a5be083c Mon Sep 17 00:00:00 2001 From: Wooseok Han <59460718+wooseok123@users.noreply.github.com> Date: Fri, 26 Jul 2024 13:25:07 +0900 Subject: [PATCH 1/2] feat : add data argument in Scene.switch --- src/scene/SceneManager.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/scene/SceneManager.js b/src/scene/SceneManager.js index 990cb5774..e17944540 100644 --- a/src/scene/SceneManager.js +++ b/src/scene/SceneManager.js @@ -1322,10 +1322,11 @@ var SceneManager = new Class({ * * @param {(string|Phaser.Scene)} from - The Scene to sleep. * @param {(string|Phaser.Scene)} to - The Scene to start. + * @param {object} [data] - Optional data object to pass to `Scene.Settings` and `Scene.init`, and `Scene.create`. It is only passed when the scene starts for the first time. * * @return {this} This Scene Manager instance. */ - switch: function (from, to) + switch: function (from, to, data) { var sceneA = this.getScene(from); var sceneB = this.getScene(to); @@ -1340,7 +1341,7 @@ var SceneManager = new Class({ } else { - this.start(to); + this.start(to, data); } } From cdefe1f68cb2d8fa42b453f96aba960235b89a94 Mon Sep 17 00:00:00 2001 From: Roman Chaley Date: Sun, 4 Aug 2024 16:11:37 +0200 Subject: [PATCH 2/2] Apply stroke letter by letter if there is custom letter spacing --- src/gameobjects/text/Text.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/gameobjects/text/Text.js b/src/gameobjects/text/Text.js index 85cb142d7..6c1d9dad4 100644 --- a/src/gameobjects/text/Text.js +++ b/src/gameobjects/text/Text.js @@ -1391,7 +1391,11 @@ var Text = new Class({ linePositionY = Math.round(linePositionY); } - if (style.strokeThickness) + var letterSpacing = this.letterSpacing; + + // Apply stroke to the whole line only if there's no custom letter spacing + + if (style.strokeThickness && letterSpacing === 0) { style.syncShadow(context, style.shadowStroke); @@ -1404,8 +1408,6 @@ var Text = new Class({ // Looping fillText could be an expensive operation, we should ignore it if it is not needed - var letterSpacing = this.letterSpacing; - if (letterSpacing !== 0) { var charPositionX = 0; @@ -1415,6 +1417,15 @@ var Text = new Class({ // Draw text letter by letter for (var l = 0; l < line.length; l++) { + if (style.strokeThickness) + { + style.syncShadow(context, style.shadowStroke); + + context.strokeText(line[l], linePositionX + charPositionX, linePositionY); + + style.syncShadow(context, style.shadowFill); + } + context.fillText(line[l], linePositionX + charPositionX, linePositionY); charPositionX += context.measureText(line[l]).width + letterSpacing;