Skip to content

Commit ff1a378

Browse files
committed
don't allow for node level color props
1 parent defa3f7 commit ff1a378

File tree

2 files changed

+14
-21
lines changed

2 files changed

+14
-21
lines changed

components/lib/createArComponent.js

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,15 @@ export default (mountConfig, propTypes = {}, nonUpdateablePropKeys = []) => {
6969
// any custom props (material, shape, ...)
7070
const nonNodePropKeys = keys(propTypes);
7171

72-
const parseMaterials = props => {
73-
const material = props.material || {};
74-
75-
if (props.color) {
76-
material.diffuse = { ...material.diffuse, color: props.color };
77-
}
78-
79-
return {
80-
...props,
81-
...(props.shadowColor
82-
? { shadowColor: processColor(props.shadowColor) }
83-
: {}),
84-
...(props.material
85-
? { material: processMaterialPropertyContents(material) }
86-
: {}),
87-
};
88-
};
72+
const parseMaterials = props => ({
73+
...props,
74+
...(props.shadowColor
75+
? { shadowColor: processColor(props.shadowColor) }
76+
: {}),
77+
...(props.material
78+
? { material: processMaterialPropertyContents(props.material) }
79+
: {}),
80+
});
8981

9082
const getNonNodeProps = props => ({
9183
...pick(props, nonNodePropKeys),

components/lib/parseMaterial.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,17 @@ export function processMaterialPropertyContents(material) {
1414
Object.keys(material),
1515
materialPropertiesWithMaps,
1616
);
17-
// legacy support for old diffuse.color
18-
const color =
19-
typeof material.diffuse === 'string' ? material.diffuse : undefined;
2017

2118
return propsToUpdate.reduce(
2219
(prev, curr) => ({
2320
...prev,
2421
[curr]: {
2522
...prev[curr],
26-
color: processColor(color || prev[curr].color),
23+
color: processColor(
24+
curr === 'diffuse' && typeof prev[curr] === 'string'
25+
? prev[curr]
26+
: prev[curr].color,
27+
),
2728
},
2829
}),
2930
material,

0 commit comments

Comments
 (0)