Updated color option type styling

This commit is contained in:
thecozies 2024-07-11 12:38:22 -05:00
parent 21a71702a0
commit 4f02b48cd5
3 changed files with 53 additions and 9 deletions

File diff suppressed because one or more lines are too long

View File

@ -187,6 +187,52 @@
color: $color-primary;
}
.config-option-color {
width: 100%;
max-width: space(360);
height: auto;
margin-top: space(4);
margin-left: space(12);
padding: 0;
&__preview-wrapper {
display: flex;
flex-direction: row;
width: 100%;
height: space(8 * 9);
}
&__preview-block {
display: block;
width: space(8 * 11);
height: 100%;
border-width: $border-width-thickness;
border-radius: $border-radius-lg;
border-color: $color-border;
}
&__hsv-wrapper {
display: flex;
flex: 1 1 100%;
flex-direction: column;
width: auto;
height: auto;
padding-left: space(8);
.config-option-range {
flex: 1 1 auto;
label {
min-width: space(72);
}
input {
flex: 1 1 auto;
}
}
}
}
.config-option-range {
display: flex;
flex-direction: row;

View File

@ -127,8 +127,6 @@ void ElementOptionTypeColor::set_config_store_rgb() {
void ElementOptionTypeColor::init_option(std::string& _config_key) {
config_key = _config_key;
const json& option_json = recomp::config::get_json_from_key(config_key);
@ -161,10 +159,10 @@ void ElementOptionTypeColor::init_option(std::string& _config_key) {
void ElementOptionTypeColor::ProcessEvent(Rml::Event& event)
{
if (event == Rml::EventId::Change)
{
if (event.GetPhase() == Rml::EventPhase::Bubble || event.GetPhase() == Rml::EventPhase::Target)
{
if (event == Rml::EventId::Change)
{
if (event.GetPhase() == Rml::EventPhase::Bubble || event.GetPhase() == Rml::EventPhase::Target)
{
Rml::Element *target = event.GetTargetElement();
auto val_variant = target->GetAttribute("value");
int new_value = val_variant->Get<int>();
@ -178,8 +176,8 @@ void ElementOptionTypeColor::ProcessEvent(Rml::Event& event)
}
set_value_label(hsv_index);
set_config_store_rgb();
}
}
}
}
}
} // namespace Rml