Skip to content

Commit ecd36ba

Browse files
committed
fix: toggle faucet during animation
1 parent e3f6407 commit ecd36ba

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/stores/faucetDetail.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const useFaucetDetail = defineStore('faucetDetail', {
1515
},
1616
isOpen: false,
1717
isVisible: false,
18+
animationPending: false,
1819
contentStep: 0,
1920
status: 'null' as RequestStatus,
2021
selectedFaucet: {} as Faucet,
@@ -50,6 +51,8 @@ export const useFaucetDetail = defineStore('faucetDetail', {
5051
},
5152

5253
popupToggle() {
54+
if (this.animationPending || this.status === 'pending') return
55+
this.animationPending = true
5356
this.isOpen = !this.isOpen
5457
if (this.isOpen) this.isVisible = true
5558

@@ -69,19 +72,24 @@ export const useFaucetDetail = defineStore('faucetDetail', {
6972
},
7073
})
7174

72-
gsap.to(this.DOM.bg, { autoAlpha: this.isOpen ? 1 : 0, duration: 1, delay: this.isOpen ? 0 : 0.4 })
7375
gsap.to(this.DOM.popup, {
7476
top: this.isOpen ? '50%' : '45%',
7577
autoAlpha: this.isOpen ? 1 : 0,
7678
'clip-path': this.isOpen ? 'polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)' : 'polygon(0% 0%, 100% 0%, 100% 0%, 0% 0%)',
7779
duration: 0.6,
7880
delay: this.isOpen ? 0.4 : 0,
81+
})
82+
gsap.to(this.DOM.bg, {
83+
autoAlpha: this.isOpen ? 1 : 0,
84+
duration: 1,
85+
delay: this.isOpen ? 0 : 0.4,
7986
onComplete: () => {
8087
if (!this.isOpen) {
8188
this.contentStep = 0
8289
this.isVisible = false
8390
}
8491
this.status = 'null'
92+
this.animationPending = false
8593
},
8694
})
8795
},

0 commit comments

Comments
 (0)