From 10f906222e06b84bb0c68ff63fe504d1b4edeaa3 Mon Sep 17 00:00:00 2001 From: sverosak Date: Thu, 20 Mar 2014 11:58:32 +0100 Subject: [PATCH] set 45 px / 10px offset for swipes --- lib/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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') {