Skip to content

Commit 7faa1de

Browse files
isnotinvainffAudio
authored andcommitted
Fix: Apply type defaults to nodes without class attribute
The Types section in stylesheets was only being checked inside the class iteration loop, meaning nodes without any class attribute would never receive type defaults. This adds the type lookup as a fallback after the class loop.
1 parent a9de8d8 commit 7faa1de

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

modules/foleys_gui_magic/Layout/foleys_Stylesheet.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,19 @@ juce::var Stylesheet::getStyleProperty (const juce::Identifier& name, const juce
222222
}
223223
}
224224

225+
// Check type defaults even if no class is assigned
226+
if (inherit)
227+
{
228+
auto typeNode = currentStyle.getChildWithName (IDs::types).getChildWithName (node.getType());
229+
if (typeNode.isValid() && typeNode.hasProperty (name))
230+
{
231+
if (definedHere)
232+
*definedHere = typeNode;
233+
234+
return typeNode.getProperty (name);
235+
}
236+
}
237+
225238
auto parent = node.getParent();
226239
if (parent.isValid() && parent.getType() != IDs::magic)
227240
return getStyleProperty (name, parent, false, definedHere);

0 commit comments

Comments
 (0)