fix: init outline width

This commit is contained in:
cptbtptpbcptdtptp
2026-05-02 17:21:46 +08:00
parent aa2442dc3c
commit 9a1a34b453
2 changed files with 6 additions and 0 deletions

View File

@@ -346,6 +346,9 @@ export class TextRenderer extends Renderer implements ITextRenderer {
this._font = engine._textDefaultFont;
this._addResourceReferCount(this._font, 1);
this.setMaterial(engine._basicResources.textDefaultMaterial);
const shaderData = this.shaderData;
shaderData.setFloat(TextRenderer._outlineWidthProperty, this._outlineWidth);
shaderData.setColor(TextRenderer._outlineColorProperty, this._outlineColor);
//@ts-ignore
this._color._onValueChanged = this._onColorChanged.bind(this);
// @ts-ignore

View File

@@ -274,6 +274,9 @@ export class Text extends UIRenderer implements ITextRenderer {
this.raycastEnabled = false;
// @ts-ignore
this.setMaterial(engine._basicResources.textDefaultMaterial);
const shaderData = this.shaderData;
shaderData.setFloat(Text._outlineWidthProperty, this._outlineWidth);
shaderData.setColor(Text._outlineColorProperty, this._outlineColor);
// @ts-ignore
this._outlineColor._onValueChanged = this._onOutlineColorChanged.bind(this);
}