Skip to content

Commit 958e209

Browse files
committed
Fix #216 changing the ease now defaults the args
1 parent 2cb4ef4 commit 958e209

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/components/keyframeEasings.svelte

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
3939
let easingType: string = 'linear'
4040
let easingMode: string | undefined
41-
let easingArg: Valuable<number>
41+
let easingArg: Valuable<number> | undefined
4242
4343
function getSelectedEasing() {
4444
if (!selectedKeyframe?.easing) return
@@ -67,26 +67,23 @@
6767
mode && mode !== 'inout' ? mode[0].toUpperCase() + mode.slice(1) : 'InOut'
6868
}${type[0].toUpperCase() + type.slice(1)}`
6969
}
70-
easingType = type
71-
easingMode = mode
72-
console.log(selectedKeyframe.easing, easingType, easingMode)
73-
if (hasArgs(selectedKeyframe.easing)) {
70+
if (easingType !== type) {
7471
getEasingArgs()
7572
}
73+
easingType = type
74+
easingMode = mode
7675
}
7776
7877
let unsub: () => void
7978
function getEasingArgs() {
8079
if (!selectedKeyframe) return
81-
if (selectedKeyframe.easingArgs) {
82-
easingArg = new Valuable(
83-
selectedKeyframe.easingArgs[0] || getEasingArgDefault(selectedKeyframe) || 0,
84-
)
85-
} else {
80+
unsub && unsub()
81+
if (hasArgs(selectedKeyframe.easing)) {
8682
easingArg = new Valuable(getEasingArgDefault(selectedKeyframe) || 0)
83+
unsub = easingArg.subscribe(value => setEasingArgs(value))
84+
} else {
85+
easingArg = undefined
8786
}
88-
unsub && unsub()
89-
unsub = easingArg.subscribe(value => setEasingArgs(value))
9087
}
9188
9289
function setEasingArgs(arg: number) {

0 commit comments

Comments
 (0)