Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[WEEX-616][iOS] scroller support borderRadius (#1533)
Browse files Browse the repository at this point in the history
  • Loading branch information
doumafang authored and cxfeng1 committed Sep 19, 2018
1 parent 03d8db2 commit cc0f889
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ typedef id (^WXDataBindingBlock)(NSDictionary *data, BOOL *needUpdate);
*/
UIColor *_backgroundColor;
NSString *_backgroundImage;
NSString *_clipRadius;
WXClipType _clipToBounds;
UIView *_view;
CGFloat _opacity;
Expand Down
9 changes: 9 additions & 0 deletions ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,15 @@ - (void)_drawBorderWithContext:(CGContextRef)context size:(CGSize)size
}

CGContextStrokePath(context);

//clipRadius is beta feature
//TO DO: remove _clipRadius property
if (_clipToBounds && _clipRadius) {
BOOL radiusEqual = _borderTopLeftRadius == _borderTopRightRadius && _borderTopRightRadius == _borderBottomRightRadius && _borderBottomRightRadius == _borderBottomLeftRadius;
if (!radiusEqual) {
self.layer.mask = [self drawBorderRadiusMaskLayer:rect];
}
}
}

- (BOOL)_needsDrawBorder
Expand Down
6 changes: 6 additions & 0 deletions ios/sdk/WeexSDK/Sources/Model/WXComponent.mm
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ - (instancetype)initWithRef:(NSString *)ref
_testId = [WXConvert NSString:attributes[@"testId"]];
}

//may be removed when this feature is stable
if (attributes[@"clipRadius"])
{
_clipRadius = [WXConvert NSString:attributes[@"clipRadius"]];
}

#ifdef DEBUG
WXLogDebug(@"flexLayout -> init component: ref : %@ , styles: %@",ref,styles);
WXLogDebug(@"flexLayout -> init component: ref : %@ , attributes: %@",ref,attributes);
Expand Down

0 comments on commit cc0f889

Please sign in to comment.