svelte-toast icon indicating copy to clipboard operation
svelte-toast copied to clipboard

Add touch / swipe away support

Open oneezy opened this issue 3 years ago • 4 comments

Would be a nice to feature to be able to "Swipe" the toast message away (left or right) and also make the toast "stay" on mousedown or when holding down with your finger

oneezy avatar Feb 05 '22 18:02 oneezy

Hey, thanks for your comment. On first pass I think the swipe gesture should be easy to implement, but I think there'll be many edge cases to think about, eg. what happens when a new toast is pushed during a swipe etc.

Might take a stab at this soon - marking this as a feature request in the meantime.

zerodevx avatar Feb 06 '22 15:02 zerodevx

ah yeah good point. i wonder how other apps might handle this?

one idea that comes to mind could be to pause new toast notifications from being pushed on mousedown or touch and then resume after

oneezy avatar Feb 06 '22 22:02 oneezy

A pause/throttle loop would be generally a good idea.

That said, I think there's another good way, which would be to store the target of the swipe gesture and/or the length of the current toasts at the beginning of the gesture. Then, if you pop/push in a new toast, you can just cancel the swipe or alternatively dismiss the initial target (maybe depending on a sensitivity or something like that?)

evankford avatar Mar 24 '22 18:03 evankford

yeah definitely! i like the sound of it

oneezy avatar Mar 24 '22 20:03 oneezy