@@ -68,35 +68,43 @@ const open = useVModel(props, 'open', emits, {
68
68
@escape-key-down =" emits('escapeKeyDown', $event)"
69
69
@swipe-start =" (event) => {
70
70
emits('swipeStart', event);
71
- (event.currentTarget as HTMLElement).setAttribute('data-swipe', 'start');
71
+ if (!event.defaultPrevented) {
72
+ (event.currentTarget as HTMLElement).setAttribute('data-swipe', 'start');
73
+ }
72
74
}"
73
75
@swipe-move =" (event) => {
74
76
emits('swipeMove', event);
75
- const { x, y } = event.detail.delta;
76
- const target = event.currentTarget as HTMLElement
77
- target.setAttribute('data-swipe', 'move');
78
- target.style.setProperty('--reka-toast-swipe-move-x', `${x}px`);
79
- target.style.setProperty('--reka-toast-swipe-move-y', `${y}px`);
77
+ if (!event.defaultPrevented) {
78
+ const { x, y } = event.detail.delta;
79
+ const target = event.currentTarget as HTMLElement
80
+ target.setAttribute('data-swipe', 'move');
81
+ target.style.setProperty('--reka-toast-swipe-move-x', `${x}px`);
82
+ target.style.setProperty('--reka-toast-swipe-move-y', `${y}px`);
83
+ }
80
84
}"
81
85
@swipe-cancel =" (event) => {
82
86
emits('swipeCancel', event);
83
- const target = event.currentTarget as HTMLElement
84
- target.setAttribute('data-swipe', 'cancel');
85
- target.style.removeProperty('--reka-toast-swipe-move-x');
86
- target.style.removeProperty('--reka-toast-swipe-move-y');
87
- target.style.removeProperty('--reka-toast-swipe-end-x');
88
- target.style.removeProperty('--reka-toast-swipe-end-y');
87
+ if (!event.defaultPrevented) {
88
+ const target = event.currentTarget as HTMLElement
89
+ target.setAttribute('data-swipe', 'cancel');
90
+ target.style.removeProperty('--reka-toast-swipe-move-x');
91
+ target.style.removeProperty('--reka-toast-swipe-move-y');
92
+ target.style.removeProperty('--reka-toast-swipe-end-x');
93
+ target.style.removeProperty('--reka-toast-swipe-end-y');
94
+ }
89
95
}"
90
96
@swipe-end =" (event) => {
91
97
emits('swipeEnd', event);
92
- const { x, y } = event.detail.delta;
93
- const target = event.currentTarget as HTMLElement
94
- target.setAttribute('data-swipe', 'end');
95
- target.style.removeProperty('--reka-toast-swipe-move-x');
96
- target.style.removeProperty('--reka-toast-swipe-move-y');
97
- target.style.setProperty('--reka-toast-swipe-end-x', `${x}px`);
98
- target.style.setProperty('--reka-toast-swipe-end-y', `${y}px`);
99
- open = false;
98
+ if (!event.defaultPrevented) {
99
+ const { x, y } = event.detail.delta;
100
+ const target = event.currentTarget as HTMLElement
101
+ target.setAttribute('data-swipe', 'end');
102
+ target.style.removeProperty('--reka-toast-swipe-move-x');
103
+ target.style.removeProperty('--reka-toast-swipe-move-y');
104
+ target.style.setProperty('--reka-toast-swipe-end-x', `${x}px`);
105
+ target.style.setProperty('--reka-toast-swipe-end-y', `${y}px`);
106
+ open = false;
107
+ }
100
108
}"
101
109
>
102
110
<slot
0 commit comments