Skip to content

Commit

Permalink
* [ios] fix : Change the parameter wording to make it more in line wi…
Browse files Browse the repository at this point in the history
…th development habits.
  • Loading branch information
bluebird78999 committed Dec 16, 2016
1 parent d3afb6f commit 869da54
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions ios/sdk/WeexSDK/Sources/Component/WXSliderComponent.m
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ @interface WXSliderComponent ()<WXSliderViewDelegate>
@property (nonatomic, assign) BOOL autoPlay;
@property (nonatomic, assign) NSUInteger interval;
@property (nonatomic, assign) NSInteger index;
@property (nonatomic, assign) CGFloat lastXDeviationPercent;
@property (nonatomic, assign) CGFloat scrollAccuracy;
@property (nonatomic, assign) CGFloat lastoffsetXRatio;
@property (nonatomic, assign) CGFloat offsetXAccuracy;
@property (nonatomic, assign) BOOL sliderChangeEvent;
@property (nonatomic, assign) BOOL sliderScrollEvent;
@property (nonatomic, strong) NSMutableArray *childrenView;
Expand All @@ -315,7 +315,7 @@ - (instancetype)initWithRef:(NSString *)ref type:(NSString *)type styles:(NSDict
_sliderScrollEvent = NO;
_interval = 3000;
_childrenView = [NSMutableArray new];
_lastXDeviationPercent = 0;
_lastoffsetXRatio = 0;

if (attributes[@"autoPlay"]) {
_autoPlay = [attributes[@"autoPlay"] boolValue];
Expand All @@ -329,8 +329,8 @@ - (instancetype)initWithRef:(NSString *)ref type:(NSString *)type styles:(NSDict
_index = [attributes[@"index"] integerValue];
}

if (attributes[@"xDeviationAccuracy"]) {
_scrollAccuracy = [WXConvert CGFloat:attributes[@"xDeviationAccuracy"]];
if (attributes[@"offsetXAccuracy"]) {
_offsetXAccuracy = [WXConvert CGFloat:attributes[@"offsetXAccuracy"]];
}

self.cssNode->style.flex_direction = CSS_FLEX_DIRECTION_ROW;
Expand Down Expand Up @@ -458,8 +458,8 @@ - (void)updateAttributes:(NSDictionary *)attributes
[_sliderView scroll2ItemView:self.currentIndex animated:YES];
}

if (attributes[@"xDeviationAccuracy"]) {
_scrollAccuracy = [WXConvert CGFloat:attributes[@"xDeviationAccuracy"]];
if (attributes[@"offsetXAccuracy"]) {
_offsetXAccuracy = [WXConvert CGFloat:attributes[@"offsetXAccuracy"]];
}
}

Expand Down Expand Up @@ -539,10 +539,10 @@ - (void)sliderView:(WXSliderView *)sliderView sliderViewDidScroll:(UIScrollView
if (_sliderScrollEvent) {
CGFloat width = scrollView.frame.size.width;
CGFloat XDeviation = scrollView.frame.origin.x - (scrollView.contentOffset.x - width);
CGFloat XDeviationPercent = (XDeviation / width);
if (ABS(XDeviationPercent - _lastXDeviationPercent) >= _scrollAccuracy) {
_lastXDeviationPercent = XDeviationPercent;
[self fireEvent:@"scroll" params:@{@"XDeviationPercent":[NSNumber numberWithFloat:XDeviationPercent]} domChanges:nil];
CGFloat offsetXRatio = (XDeviation / width);
if (ABS(offsetXRatio - _lastoffsetXRatio) >= _offsetXAccuracy) {
_lastoffsetXRatio = offsetXRatio;
[self fireEvent:@"scroll" params:@{@"offsetXRatio":[NSNumber numberWithFloat:offsetXRatio]} domChanges:nil];
}
}
}
Expand Down

0 comments on commit 869da54

Please # to comment.