From c941ea2cc4f079592118888ee7e2e2e3af4c99f5 Mon Sep 17 00:00:00 2001 From: Giuseppe Date: Mon, 2 Sep 2013 18:49:39 +0200 Subject: [PATCH] Round offset position to avoid antialiasing problem When the position is a rounded number, some browser doesn't render the text correctly. Rounding the offset solve the problem. --- src/directives/rn-carousel.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/directives/rn-carousel.js b/src/directives/rn-carousel.js index 5e6d0e8..d07e9d2 100644 --- a/src/directives/rn-carousel.js +++ b/src/directives/rn-carousel.js @@ -227,7 +227,7 @@ angular.module('angular-carousel') window.addEventListener('orientationchange', resize); // when window is resized (responsive design) window.addEventListener('resize', resize); - + function resize () { updateContainerWidth(); updateSlidePosition(); @@ -256,7 +256,7 @@ angular.module('angular-carousel') /* trigger carousel position update */ skipAnimation = !!forceSkipAnimation || skipAnimation; if (containerWidth===0) updateContainerWidth(); - offset = scope.carouselCollection.getRelativeIndex() * -containerWidth; + offset = Math.round(scope.carouselCollection.getRelativeIndex() * -containerWidth); if (skipAnimation===true) { carousel.removeClass('rn-carousel-animate') .addClass('rn-carousel-noanimate')