From bc2e953696b1f1b2517cf28bd26eaee2aefa911a Mon Sep 17 00:00:00 2001 From: evenemento Date: Thu, 15 May 2014 17:59:30 +0200 Subject: [PATCH] Prevent slide right on last and left on first When continuous was disabled, user could slide right on last or left on first and they received empty view. Problem was of the order of operations which calculate isPastBounds. a = true b = true c = false d = false earlier it was calculate: a && b | c && d = true | false && false = true & false = false after change (a && b) | (c && d) = true | false = true --- js/views/sliderView.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/views/sliderView.js b/js/views/sliderView.js index fc87e72ac74..12318bc84d6 100644 --- a/js/views/sliderView.js +++ b/js/views/sliderView.js @@ -377,8 +377,8 @@ ionic.views.Slider = ionic.views.View.inherit({ // determine if slide attempt is past start and end var isPastBounds = - !index && delta.x > 0 | // if first slide and slide amt is greater than 0 - index == slides.length - 1 && delta.x < 0; // or if last slide and slide amt is less than 0 + (!index && delta.x > 0) | // if first slide and slide amt is greater than 0 + (index == slides.length - 1 && delta.x < 0); // or if last slide and slide amt is less than 0 if (options.continuous) isPastBounds = false;