Skip to content

Commit e90cd28

Browse files
Force type boolean for loop property on animation component with specific id (fix #612) (#813)
1 parent f32ad77 commit e90cd28

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/components/components/PropertyRow.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,15 @@ export default class PropertyRow extends React.Component {
4141
props.componentname === 'material' &&
4242
(props.name === 'envMap' || props.name === 'src');
4343
let type = props.schema.type;
44-
if (props.componentname === 'animation' && props.name === 'loop') {
45-
// fix wrong number type for animation loop property
44+
if (
45+
(props.componentname === 'animation' ||
46+
props.componentname.startsWith('animation__')) &&
47+
props.name === 'loop'
48+
) {
49+
// The loop property can be a boolean for an infinite loop or a number to set the number of iterations.
50+
// It's auto detected as number because the default value is 0, but for most use case we want an infinite loop
51+
// so we're forcing the type to boolean. In the future we could create a custom widget to allow user to choose
52+
// between infinite loop and number of iterations.
4653
type = 'boolean';
4754
}
4855

0 commit comments

Comments
 (0)