diff --git a/doric-demo/src/SliderStyleDemo.ts b/doric-demo/src/SliderStyleDemo.ts index b600be8a..8c25824a 100644 --- a/doric-demo/src/SliderStyleDemo.ts +++ b/doric-demo/src/SliderStyleDemo.ts @@ -34,8 +34,8 @@ class SliderStyleDemo extends Panel { } })) - setTimeout(() => { - pager.slidePage(this.context, 2, false); - }, 200) + // setTimeout(() => { + // pager.slidePage(this.context, 2, false); + // }, 200) } } \ No newline at end of file diff --git a/doric-iOS/Pod/Classes/Shader/DoricSliderNode.m b/doric-iOS/Pod/Classes/Shader/DoricSliderNode.m index 83eb4e9c..abb5830e 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricSliderNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricSliderNode.m @@ -441,7 +441,7 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView { - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { NSUInteger pageIndex; if ([self.slideStyle isEqualToString:@"gallery"]) { - pageIndex = (NSUInteger) (scrollView.contentOffset.x / self.galleryItemWidth); + pageIndex = (NSUInteger) (scrollView.contentOffset.x / self.galleryItemWidth + 0.5f); scrollView.contentOffset = CGPointMake(pageIndex * self.galleryItemWidth, scrollView.contentOffset.y); } else { pageIndex = (NSUInteger) (scrollView.contentOffset.x / scrollView.width);