From 8215350dda9eb343f1a40b1125d7cd850dca63d5 Mon Sep 17 00:00:00 2001 From: Flutterish Date: Mon, 15 Mar 2021 23:20:01 +0100 Subject: [PATCH] fix hex text --- Hitokori/UI/ColorPickerControl.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Hitokori/UI/ColorPickerControl.cs b/Hitokori/UI/ColorPickerControl.cs index f80c10a..0adb2e5 100644 --- a/Hitokori/UI/ColorPickerControl.cs +++ b/Hitokori/UI/ColorPickerControl.cs @@ -119,7 +119,7 @@ public ColorPickerControl () { } hexPreview.Current.ValueChanged += v => { - if ( !hexPreview.HasFocus ) return; + if ( !hexPreview.HasFocus || lockedBindable.Value ) return; var text = hexPreview.Text.TrimStart( '#' ); if ( text.Length == 6 && text.All( c => "0123456789aAbBcCdDeEfF".Contains( c ) ) ) { @@ -129,10 +129,6 @@ public ColorPickerControl () { HSV.Color.Value = new Color4( r, g, b, 255 ); } }; - - lockedBindable.BindValueChanged( v => { - hexPreview.ReadOnly = v.NewValue; - }, true ); } const float COLOR_HEIGHT = 35; @@ -155,6 +151,10 @@ protected override void Update () { colorLockAndPreviewSide.Width = DrawWidth - pickerSide.DrawWidth; previewSide.Height = colorLockAndPreviewSide.DrawHeight - lockToggle.DrawHeight - COLOR_HEIGHT; hexPreview.Width = colorAndLockSide.DrawWidth - colorPreview.DrawWidth - 10; + + if ( lockedBindable.Value ) { + hexPreview.Text = HSV.Color.Value.ToHex(); + } } } }