fix: defaults
This commit is contained in:
parent
feb5b58e21
commit
700ed92b68
|
@ -34,14 +34,14 @@ const Animated = ({json, path}) => {
|
|||
Offset
|
||||
<VectorComponent
|
||||
onChange={patch.onChange(join(path, 'params/animations', key, 'offset'))}
|
||||
value={animation.offset}
|
||||
value={animation.offset || [0, 0]}
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Jitter
|
||||
<Number
|
||||
onChange={patch.onChange(join(path, 'params/animations', key, 'jitter'))}
|
||||
value={animation.jitter}
|
||||
value={animation.jitter || 0}
|
||||
/>
|
||||
</label>
|
||||
</>
|
||||
|
|
|
@ -307,4 +307,17 @@ export default (latus) => class Animated extends decorate(Trait) {
|
|||
animation.tick(elapsed);
|
||||
}
|
||||
|
||||
static withoutDefaults(json) {
|
||||
Object.keys(json.params.animations).forEach((key) => {
|
||||
const animation = json.params.animations[key];
|
||||
if (Vector.equals([0, 0], animation.offset)) {
|
||||
delete animation.offset;
|
||||
}
|
||||
if (0 === animation.jitter) {
|
||||
delete animation.jitter;
|
||||
}
|
||||
});
|
||||
return super.withoutDefaults(json);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user