@@ -13,7 +13,6 @@ export const onDragMove = Symbol('onDragMove');
13
13
export const onDragStop = Symbol ( 'onDragStop' ) ;
14
14
export const onMirrorCreated = Symbol ( 'onMirrorCreated' ) ;
15
15
export const onMirrorMove = Symbol ( 'onMirrorMove' ) ;
16
- export const onScroll = Symbol ( 'onScroll' ) ;
17
16
export const getAppendableContainer = Symbol ( 'getAppendableContainer' ) ;
18
17
19
18
/**
@@ -67,31 +66,11 @@ export default class Mirror extends AbstractPlugin {
67
66
...this . getOptions ( ) ,
68
67
} ;
69
68
70
- /**
71
- * Scroll offset for touch devices because the mirror is positioned fixed
72
- * @property {Object } scrollOffset
73
- * @property {Number } scrollOffset.x
74
- * @property {Number } scrollOffset.y
75
- */
76
- this . scrollOffset = { x : 0 , y : 0 } ;
77
-
78
- /**
79
- * Initial scroll offset for touch devices because the mirror is positioned fixed
80
- * @property {Object } scrollOffset
81
- * @property {Number } scrollOffset.x
82
- * @property {Number } scrollOffset.y
83
- */
84
- this . initialScrollOffset = {
85
- x : window . scrollX ,
86
- y : window . scrollY ,
87
- } ;
88
-
89
69
this [ onDragStart ] = this [ onDragStart ] . bind ( this ) ;
90
70
this [ onDragMove ] = this [ onDragMove ] . bind ( this ) ;
91
71
this [ onDragStop ] = this [ onDragStop ] . bind ( this ) ;
92
72
this [ onMirrorCreated ] = this [ onMirrorCreated ] . bind ( this ) ;
93
73
this [ onMirrorMove ] = this [ onMirrorMove ] . bind ( this ) ;
94
- this [ onScroll ] = this [ onScroll ] . bind ( this ) ;
95
74
}
96
75
97
76
/**
@@ -131,15 +110,6 @@ export default class Mirror extends AbstractPlugin {
131
110
return ;
132
111
}
133
112
134
- if ( 'ontouchstart' in window ) {
135
- document . addEventListener ( 'scroll' , this [ onScroll ] , true ) ;
136
- }
137
-
138
- this . initialScrollOffset = {
139
- x : window . scrollX ,
140
- y : window . scrollY ,
141
- } ;
142
-
143
113
const { source, originalSource, sourceContainer, sensorEvent} = dragEvent ;
144
114
145
115
// Last sensor position of mirror move
@@ -233,13 +203,6 @@ export default class Mirror extends AbstractPlugin {
233
203
}
234
204
235
205
[ onDragStop ] ( dragEvent ) {
236
- if ( 'ontouchstart' in window ) {
237
- document . removeEventListener ( 'scroll' , this [ onScroll ] , true ) ;
238
- }
239
-
240
- this . initialScrollOffset = { x : 0 , y : 0 } ;
241
- this . scrollOffset = { x : 0 , y : 0 } ;
242
-
243
206
if ( ! this . mirror ) {
244
207
return ;
245
208
}
@@ -261,13 +224,6 @@ export default class Mirror extends AbstractPlugin {
261
224
}
262
225
}
263
226
264
- [ onScroll ] ( ) {
265
- this . scrollOffset = {
266
- x : window . scrollX - this . initialScrollOffset . x ,
267
- y : window . scrollY - this . initialScrollOffset . y ,
268
- } ;
269
- }
270
-
271
227
/**
272
228
* Mirror created handler
273
229
* @param {MirrorCreatedEvent } mirrorEvent
@@ -293,7 +249,6 @@ export default class Mirror extends AbstractPlugin {
293
249
source,
294
250
sensorEvent,
295
251
mirrorClass,
296
- scrollOffset : this . scrollOffset ,
297
252
options : this . options ,
298
253
passedThreshX : true ,
299
254
passedThreshY : true ,
@@ -337,7 +292,6 @@ export default class Mirror extends AbstractPlugin {
337
292
options : this . options ,
338
293
initialX : this . initialX ,
339
294
initialY : this . initialY ,
340
- scrollOffset : this . scrollOffset ,
341
295
passedThreshX : mirrorEvent . passedThreshX ,
342
296
passedThreshY : mirrorEvent . passedThreshY ,
343
297
lastMovedX : this . lastMovedX ,
@@ -491,7 +445,6 @@ function positionMirror({withFrame = false, initial = false} = {}) {
491
445
mirrorOffset,
492
446
initialY,
493
447
initialX,
494
- scrollOffset,
495
448
options,
496
449
passedThreshX,
497
450
passedThreshY,
@@ -511,11 +464,11 @@ function positionMirror({withFrame = false, initial = false} = {}) {
511
464
512
465
if ( mirrorOffset ) {
513
466
const x = passedThreshX
514
- ? Math . round ( ( sensorEvent . clientX - mirrorOffset . left - scrollOffset . x ) / ( options . thresholdX || 1 ) ) *
467
+ ? Math . round ( ( sensorEvent . clientX - mirrorOffset . left ) / ( options . thresholdX || 1 ) ) *
515
468
( options . thresholdX || 1 )
516
469
: Math . round ( lastMovedX ) ;
517
470
const y = passedThreshY
518
- ? Math . round ( ( sensorEvent . clientY - mirrorOffset . top - scrollOffset . y ) / ( options . thresholdY || 1 ) ) *
471
+ ? Math . round ( ( sensorEvent . clientY - mirrorOffset . top ) / ( options . thresholdY || 1 ) ) *
519
472
( options . thresholdY || 1 )
520
473
: Math . round ( lastMovedY ) ;
521
474
0 commit comments