Skip to content

Commit

Permalink
move special case "data" to itemrenderer where it belongs
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Aug 11, 2024
1 parent 7a9235b commit 85a7e74
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 7 additions & 2 deletions haxe/ui/core/ItemRenderer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,13 @@ class ItemRenderer extends Box {
}
if (!isLayoutProp) {
try {
if (RTTI.hasPrimitiveClassProperty(this.className, f)) {
Reflect.setProperty(this, f, v);
// "data" is a special case exception here as if the item renderer contained a "data" property
// it would overwrite the item renderers data property, which is, for sure, NOT
// what we want to happen... ever.
if (f != "data") {
if (RTTI.hasPrimitiveClassProperty(this.className, f)) {
Reflect.setProperty(this, f, v);
}
}
} catch (e:Dynamic) { }
} else if (allowLayoutProperties) {
Expand Down
3 changes: 0 additions & 3 deletions haxe/ui/util/RTTI.hx
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,6 @@ class RTTI {
}

private static function isPrimitiveProperty(prop:RTTIProperty):Bool {
if (prop.propertyName == "data") {
return false;
}
if (prop.propertyType == "bool" || prop.propertyType == "int" || prop.propertyType == "float" || prop.propertyType == "string" || prop.propertyType == "variant" || prop.propertyType == "dynamic") {
return true;
}
Expand Down

0 comments on commit 85a7e74

Please sign in to comment.