[Improvement] CellSwipe: optimzie animation fluency (#685)

This commit is contained in:
neverland
2018-03-13 19:41:31 +08:00
committed by GitHub
parent 4006a86cec
commit d8d1aa6e82
7 changed files with 57 additions and 69 deletions

View File

@@ -74,11 +74,11 @@ export function triggerTouch(wrapper, eventName, x, y) {
el.dispatchEvent(event);
}
export function dragHelper(el, position) {
export function dragHelper(el, x = 0, y = 0) {
triggerTouch(el, 'touchstart', 0, 0);
triggerTouch(el, 'touchmove', 0, position / 4);
triggerTouch(el, 'touchmove', 0, position / 3);
triggerTouch(el, 'touchmove', 0, position / 2);
triggerTouch(el, 'touchmove', 0, position);
triggerTouch(el, 'touchend', 0, position);
triggerTouch(el, 'touchmove', x / 4, y / 4);
triggerTouch(el, 'touchmove', x / 3, y / 3);
triggerTouch(el, 'touchmove', x / 2, y / 2);
triggerTouch(el, 'touchmove', x, y);
triggerTouch(el, 'touchend', x, y);
}