diff --git a/src/colourpicker/ColourPickerActivity.cpp b/src/colourpicker/ColourPickerActivity.cpp index b71277815..16007e17b 100644 --- a/src/colourpicker/ColourPickerActivity.cpp +++ b/src/colourpicker/ColourPickerActivity.cpp @@ -33,12 +33,22 @@ ColourPickerActivity::ColourPickerActivity(ui::Colour initialColour, ColourPicke void TextChangedCallback(ui::Textbox * sender) { - int r, g, b; + int r, g, b, alpha; r = format::StringToNumber(a->rValue->GetText()); g = format::StringToNumber(a->gValue->GetText()); b = format::StringToNumber(a->bValue->GetText()); - a->currentAlpha = format::StringToNumber(a->aValue->GetText()); RGB_to_HSV(r, g, b, &a->currentHue, &a->currentSaturation, &a->currentValue); + + if (r > 255) + a->rValue->SetText("255"); + if (g > 255) + a->gValue->SetText("255"); + if (b > 255) + a->bValue->SetText("255"); + alpha = format::StringToNumber(a->aValue->GetText()); + if (alpha > 255) + a->aValue->SetText("255"); + a->currentAlpha = format::StringToNumber(a->aValue->GetText()); } }; diff --git a/src/interface/Textbox.cpp b/src/interface/Textbox.cpp index ab4d907f1..afb9fd3c6 100644 --- a/src/interface/Textbox.cpp +++ b/src/interface/Textbox.cpp @@ -412,10 +412,6 @@ void Textbox::OnVKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool //Remove extra preceding 0's while(backingText[0] == '0' && backingText.length()>1) backingText.erase(backingText.begin()); - - //If there is no content, replace with 0 - if(!backingText.length()) - backingText = "0"; } if(cursor > backingText.length()) cursor = backingText.length();