Skip to content

Commit

Permalink
fix hex text
Browse files Browse the repository at this point in the history
  • Loading branch information
Flutterish committed Mar 15, 2021
1 parent 20befe4 commit 8215350
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Hitokori/UI/ColorPickerControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) ) {
Expand All @@ -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;
Expand All @@ -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();
}
}
}
}

0 comments on commit 8215350

Please sign in to comment.