mirror of
https://github.com/Shopify/draggable.git
synced 2026-02-01 16:46:56 +00:00
Fixes mirror position and auto scroll on touch
This commit is contained in:
parent
b351e8a9f4
commit
d60152f36f
@ -138,8 +138,8 @@ export default class AutoScroll extends AbstractPlugin {
|
||||
const sensorEvent = dragEvent.sensorEvent;
|
||||
|
||||
this.currentMousePosition = {
|
||||
clientX: sensorEvent.clientX,
|
||||
clientY: sensorEvent.clientY,
|
||||
clientX: sensorEvent.clientX - window.scrollX,
|
||||
clientY: sensorEvent.clientY - window.scrollY,
|
||||
};
|
||||
|
||||
this.scrollAnimationFrame = requestAnimationFrame(this[scroll]);
|
||||
|
||||
@ -262,8 +262,8 @@ function positionMirror({withFrame = false, initial = false} = {}) {
|
||||
};
|
||||
|
||||
if (mirrorOffset) {
|
||||
const x = sensorEvent.clientX - mirrorOffset.left;
|
||||
const y = sensorEvent.clientY - mirrorOffset.top;
|
||||
const x = sensorEvent.clientX - mirrorOffset.left - window.scrollX;
|
||||
const y = sensorEvent.clientY - mirrorOffset.top - window.scrollY;
|
||||
|
||||
if ((options.xAxis && options.yAxis) || initial) {
|
||||
mirror.style.transform = `translate3d(${x}px, ${y}px, 0)`;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user