From b2eb4e5e888c89fe8d5ce592fbf9aa9609a70f46 Mon Sep 17 00:00:00 2001 From: "LiuHongfeng(GuJian)" Date: Sun, 5 Mar 2017 20:26:30 +0800 Subject: [PATCH 1/2] * [ios] fix bug:The calculation of neighbor-space does not take into account the current item scaling. --- .../WeexSDK/Sources/Component/WXSliderNeighborComponent.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ios/sdk/WeexSDK/Sources/Component/WXSliderNeighborComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXSliderNeighborComponent.m index ccc47f9c8f..e86a962c8e 100644 --- a/ios/sdk/WeexSDK/Sources/Component/WXSliderNeighborComponent.m +++ b/ios/sdk/WeexSDK/Sources/Component/WXSliderNeighborComponent.m @@ -1748,7 +1748,11 @@ - (void)updateSliderPage:(BOOL)animate __strong typeof(self) strongSelf = weakSelf; if (strongSelf) { currentView.alpha = 1.0; - + if (strongSelf->currentItemScale > 1) { + strongSelf->currentItemScale = 1; + }else if(strongSelf->currentItemScale < CGFLOAT_MIN) { + strongSelf->currentItemScale = CGFLOAT_MIN; + } if (fabs(strongSelf->currentItemScale) > CGFLOAT_MIN) { transfrom = CGAffineTransformConcat(transfrom,CGAffineTransformMakeScale(strongSelf->currentItemScale, strongSelf->currentItemScale)); } @@ -1758,7 +1762,7 @@ - (void)updateSliderPage:(BOOL)animate strongSelf->neighborScale = DEFAULT_NEIGHBOR_ITEM_SCALE; } - CGFloat tx = 0.5*_itemRect.size.width*((1-self->neighborScale)+(1-0.9))-self->neighborSpace; + CGFloat tx = 0.5*_itemRect.size.width*((1-self->neighborScale)+(1-self->currentItemScale))-self->neighborSpace; transfrom = CGAffineTransformConcat(transfrom, CGAffineTransformMakeScale(strongSelf->neighborScale, strongSelf->neighborScale)); nextView.transform = CGAffineTransformConcat(transfrom, CGAffineTransformMakeTranslation(-tx, 0)); lastView.transform = CGAffineTransformConcat(transfrom, CGAffineTransformMakeTranslation(tx, 0)); From 6d9f214a522d96fe38be40287270aa30448334e4 Mon Sep 17 00:00:00 2001 From: "LiuHongfeng(GuJian)" Date: Sun, 5 Mar 2017 20:41:02 +0800 Subject: [PATCH 2/2] * [ios] fix:remove redundant code --- .../WeexSDK/Sources/Component/WXSliderNeighborComponent.m | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ios/sdk/WeexSDK/Sources/Component/WXSliderNeighborComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXSliderNeighborComponent.m index e86a962c8e..830205e219 100644 --- a/ios/sdk/WeexSDK/Sources/Component/WXSliderNeighborComponent.m +++ b/ios/sdk/WeexSDK/Sources/Component/WXSliderNeighborComponent.m @@ -1748,11 +1748,6 @@ - (void)updateSliderPage:(BOOL)animate __strong typeof(self) strongSelf = weakSelf; if (strongSelf) { currentView.alpha = 1.0; - if (strongSelf->currentItemScale > 1) { - strongSelf->currentItemScale = 1; - }else if(strongSelf->currentItemScale < CGFLOAT_MIN) { - strongSelf->currentItemScale = CGFLOAT_MIN; - } if (fabs(strongSelf->currentItemScale) > CGFLOAT_MIN) { transfrom = CGAffineTransformConcat(transfrom,CGAffineTransformMakeScale(strongSelf->currentItemScale, strongSelf->currentItemScale)); }