Skip to content

Commit 4efaf8e

Browse files
authored
Code improvements after 4.1.0 release (#5022)
* Align spacing * Fix typo * Improve readability * Update lockfile In 30e762e the peer dependency was upgraded, but the lock file was not included in that commit.
1 parent 15cff34 commit 4efaf8e

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/model-viewer/src/features/animation.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ interface PlayAnimationOptions {
3232

3333
interface AppendAnimationOptions {
3434
pingpong: boolean, repetitions: number|null, weight: number,
35-
timeScale: number, fade: boolean|number, warp: boolean|number,
36-
relativeWarp: boolean, time: number|null
35+
timeScale: number, fade: boolean|number, warp: boolean|number,
36+
relativeWarp: boolean, time: number|null
3737
}
3838

3939
interface DetachAnimationOptions {
@@ -115,9 +115,9 @@ export const AnimationMixin = <T extends Constructor<ModelViewerElementBase>>(
115115
if (!this[$scene].appendedAnimations.includes(e.action._clip.name)) {
116116
this[$paused] = true;
117117
} else {
118-
const filterdList = this[$scene].appendedAnimations.filter(
118+
const filteredList = this[$scene].appendedAnimations.filter(
119119
i => i !== e.action._clip.name);
120-
this[$scene].appendedAnimations = filterdList;
120+
this[$scene].appendedAnimations = filteredList;
121121
}
122122
this.dispatchEvent(new CustomEvent('finished'));
123123
});

packages/model-viewer/src/features/environment.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,16 @@ export const EnvironmentMixin = <T extends Constructor<ModelViewerElementBase>>(
8989
}
9090

9191
if (changedProperties.has('toneMapping')) {
92-
this[$scene].toneMapping = this.toneMapping === 'aces' ?
93-
ACESFilmicToneMapping :
94-
this.toneMapping === 'agx' ? AgXToneMapping :
95-
this.toneMapping === 'reinhard' ? ReinhardToneMapping :
96-
this.toneMapping === 'cineon' ? CineonToneMapping :
97-
this.toneMapping === 'linear' ? LinearToneMapping :
98-
this.toneMapping === 'none' ? NoToneMapping :
99-
NeutralToneMapping;
92+
const TONE_MAPPING = new Map([
93+
['aces', ACESFilmicToneMapping],
94+
['agx', AgXToneMapping],
95+
['reinhard', ReinhardToneMapping],
96+
['cineon', CineonToneMapping],
97+
['linear', LinearToneMapping],
98+
['none', NoToneMapping]
99+
]);
100+
101+
this[$scene].toneMapping = TONE_MAPPING.get(this.toneMapping) ?? NeutralToneMapping;
100102
this[$needsRender]();
101103
}
102104

0 commit comments

Comments
 (0)