| 757 | } |
| 758 | |
| 759 | void ColorPicker::ApplyChannelTextBoxValue(const wuxc::TextBox &channelTextBox, txmp::ColorChannel channel) |
| 760 | { |
| 761 | if (channelTextBox) |
| 762 | { |
| 763 | const auto text = channelTextBox.Text(); |
| 764 | if (Util::Trim(text).empty()) |
| 765 | { |
| 766 | // An empty string is allowed and happens when the clear TextBox button is pressed |
| 767 | // This case should be interpreted as zero |
| 768 | SetColorChannel(GetActiveColorRepresentation(), channel, 0.0); |
| 769 | } |
| 770 | else if (auto parsed = m_DecimalFormatter.ParseDouble(text)) |
| 771 | { |
| 772 | SetColorChannel(GetActiveColorRepresentation(), channel, parsed.Value()); |
| 773 | } |
| 774 | else |
| 775 | { |
| 776 | // Reset TextBox values |
| 777 | UpdateColorControlValues(); |
| 778 | UpdateChannelSliderBackgrounds(); |
| 779 | } |
| 780 | } |
| 781 | } |
| 782 | |
| 783 | void ColorPicker::ScheduleColorUpdate(Windows::UI::Color newColor, bool isFromSpectrum) |
| 784 | { |