Skip to content

Commit b47c0f1

Browse files
committed
fix: dont trigger unecessary animations
1 parent ff820af commit b47c0f1

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/ui-drawer/index.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -849,20 +849,23 @@ export class Drawer extends GridLayout {
849849
}
850850

851851
// TODO: custom animation curve + apply curve on gesture
852-
const params = Object.keys(trData)
853-
.map(
854-
(k) =>
855-
this[k] &&
856-
Object.assign(
852+
const params = [];
853+
Object.keys(trData).forEach((k) => {
854+
if (this[k]) {
855+
const animatedParams = duration ? transformAnimationValues(trData[k]) : trData[k];
856+
if (Object.keys(animatedParams).length) {
857+
const animParam = Object.assign(
857858
{
858859
target: this[k],
859860
curve: CoreTypes.AnimationCurve.easeInOut,
860861
duration
861862
},
862-
duration ? transformAnimationValues(trData[k]) : trData[k]
863-
)
864-
)
865-
.filter((a) => !!a);
863+
animatedParams
864+
);
865+
params.push(animParam);
866+
}
867+
}
868+
});
866869
try {
867870
if (duration) {
868871
if (this.animationFunction) {

0 commit comments

Comments
 (0)