@@ -126,6 +126,13 @@ export default {
126
126
return ` translate3d(${ offset} px, 0, 0)` ;
127
127
},
128
128
129
+ setAnimations (on ) {
130
+ var val = on ? null : ' 0ms' ;
131
+ this .wrap .style .transitionDuration = val;
132
+ this .rightWrapElm .style .transitionDuration = val;
133
+ this .leftWrapElm .style .transitionDuration = val;
134
+ },
135
+
129
136
swipeMove (offset = 0 ) {
130
137
this .wrap .style .webkitTransform = this .translate3d (offset);
131
138
this .rightWrapElm .style .webkitTransform = this .translate3d (this .rightWidth + offset);
@@ -172,9 +179,7 @@ export default {
172
179
if (this .opened ) {
173
180
if (! this .swiping ) {
174
181
this .swipeMove (0 );
175
- this .wrap .style .transitionDuration = null ;
176
- this .rightWrapElm .style .transitionDuration = null ;
177
- this .leftWrapElm .style .transitionDuration = null ;
182
+ this .setAnimations (true );
178
183
}
179
184
this .opened = false ;
180
185
return ;
@@ -189,9 +194,7 @@ export default {
189
194
const y = Math .abs (offsetTop);
190
195
const x = Math .abs (offsetLeft);
191
196
192
- this .wrap .style .transitionDuration = ' 0ms' ;
193
- this .rightWrapElm .style .transitionDuration = ' 0ms' ;
194
- this .leftWrapElm .style .transitionDuration = ' 0ms' ;
197
+ this .setAnimations (false );
195
198
196
199
if (this .direction === null ) {
197
200
this .direction = x > y ? ' horizonal' : ' vertical' ;
@@ -216,9 +219,7 @@ export default {
216
219
217
220
endDrag () {
218
221
this .direction = null ;
219
- this .wrap .style .transitionDuration = null ;
220
- this .rightWrapElm .style .transitionDuration = null ;
221
- this .leftWrapElm .style .transitionDuration = null ;
222
+ this .setAnimations (true );
222
223
if (! this .swiping ) return ;
223
224
this .swipeLeaveTransition (this .offsetLeft > 0 ? - 1 : 1 );
224
225
}
0 commit comments