1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-07 04:10:08 +00:00

ChoicePropertyComponent: Return default index if value is not found in value source mapper

This commit is contained in:
ed 2021-07-16 09:50:34 +01:00
parent e467473157
commit db2036e81a

View file

@ -82,19 +82,17 @@ public:
var getValue() const override
{
if (valueWithDefault == nullptr)
return {};
if (valueWithDefault != nullptr
&& ! valueWithDefault->isUsingDefault())
{
auto targetValue = sourceValue.getValue();
if (valueWithDefault->isUsingDefault())
return -1;
for (auto map : mappings)
if (map.equalsWithSameType (targetValue))
return mappings.indexOf (map) + 1;
}
auto targetValue = sourceValue.getValue();
for (auto map : mappings)
if (map.equalsWithSameType (targetValue))
return mappings.indexOf (map) + 1;
return mappings.indexOf (targetValue) + 1;
return -1;
}
void setValue (const var& newValue) override