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:
parent
e467473157
commit
db2036e81a
1 changed files with 9 additions and 11 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue