diff --git a/lib/index.js b/lib/index.js index 6dba189..686d20a 100644 --- a/lib/index.js +++ b/lib/index.js @@ -143,6 +143,8 @@ function round(num){ return Math.round(num); } +var HORIZONTAL_OFFSET = 45; +var VERTICAL_OFFSET = 10; function swipe(direction, elem, ms, frames, getEvent) { var elemSize = getChildrenSize(elem.parentNode); @@ -155,14 +157,14 @@ function swipe(direction, elem, ms, frames, getEvent) { y = elemSize.height; x = elemSize.width / 2; - from = [x*0.95, y*0.1].map(round); - to = [x*1.01, y*0.9].map(round); + from = [x*0.95, VERTICAL_OFFSET].map(round); + to = [x*1.01, y-VERTICAL_OFFSET].map(round); } else { // horizontal x = elemSize.width; y = elemSize.height / 2; - from = [x * 0.05, y].map(round); - to = [x * 0.95, y].map(round); + from = [HORIZONTAL_OFFSET, y*0.98].map(round); + to = [x - HORIZONTAL_OFFSET, y*1.01].map(round); } if (direction === 'right' || direction === 'top') {