Fix styles updating textbox

feature-better-tweakables
Andrew Cassidy 4 years ago
parent d1029ca0c1
commit ddce97ee05

@ -33,6 +33,7 @@ namespace ConformalDecals.UI {
private DecalTextStyle _style;
private Vector2 _lineSpacingRange;
private Vector2 _charSpacingRange;
private TMP_InputField _textBoxTMP;
private FontMenuController _fontMenu;
@ -79,9 +80,9 @@ namespace ConformalDecals.UI {
_font = font;
font.SetupSample(_fontButton.GetComponentInChildren<TextMeshProUGUI>());
var textBox = ((TMP_InputField) _textBox);
textBox.textComponent.fontStyle = _style.FontStyle | _font.FontStyle;
textBox.fontAsset = _font.FontAsset;
_textBoxTMP.text = _text;
_textBoxTMP.textComponent.fontStyle = _style.FontStyle | _font.FontStyle & ~_font.FontStyleMask;
_textBoxTMP.fontAsset = _font.FontAsset;
UpdateStyleButtons();
OnValueChanged();
@ -137,6 +138,7 @@ namespace ConformalDecals.UI {
if (_ignoreUpdates) return;
_style.Bold = state;
_textBoxTMP.textComponent.fontStyle = _style.FontStyle | _font.FontStyle & ~_font.FontStyleMask;
OnValueChanged();
}
@ -144,6 +146,7 @@ namespace ConformalDecals.UI {
if (_ignoreUpdates) return;
_style.Italic = state;
_textBoxTMP.textComponent.fontStyle = _style.FontStyle | _font.FontStyle & ~_font.FontStyleMask;
OnValueChanged();
}
@ -151,6 +154,7 @@ namespace ConformalDecals.UI {
if (_ignoreUpdates) return;
_style.Underline = state;
_textBoxTMP.textComponent.fontStyle = _style.FontStyle | _font.FontStyle & ~_font.FontStyleMask;
OnValueChanged();
}
@ -158,6 +162,7 @@ namespace ConformalDecals.UI {
if (_ignoreUpdates) return;
_style.SmallCaps = state;
_textBoxTMP.textComponent.fontStyle = _style.FontStyle | _font.FontStyle & ~_font.FontStyleMask;
OnValueChanged();
}
@ -170,7 +175,10 @@ namespace ConformalDecals.UI {
private void Start() {
((TMP_InputField) _textBox).text = _text;
_textBoxTMP = ((TMP_InputField) _textBox);
_textBoxTMP.text = _text;
_textBoxTMP.textComponent.fontStyle = _style.FontStyle | _font.FontStyle & ~_font.FontStyleMask;
_textBoxTMP.fontAsset = _font.FontAsset;
_font.SetupSample(_fontButton.GetComponentInChildren<TextMeshProUGUI>());

Loading…
Cancel
Save