[ 
https://issues.apache.org/jira/browse/WEEX-574?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16583342#comment-16583342
 ] 

ASF GitHub Bot commented on WEEX-574:
-------------------------------------

cxfeng1 closed pull request #1447: [WEEX-574][iOS] make 'video' and 'videoplus' 
support border radius
URL: https://github.com/apache/incubator-weex/pull/1447
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/ios/sdk/WeexSDK/Sources/Component/WXVideoComponent.m 
b/ios/sdk/WeexSDK/Sources/Component/WXVideoComponent.m
index c6b955e0bf..483f838c19 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXVideoComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXVideoComponent.m
@@ -320,19 +320,20 @@ - (instancetype)initWithRef:(NSString *)ref 
type:(NSString *)type styles:(NSDict
     return self;
 }
 
--(UIView *)loadView
+- (UIView *)loadView
 {
     WXVideoView* videoView = [[WXVideoView alloc] init];
     videoView.weexSDKInstance = self.weexInstance;
-    
     return videoView;
 }
 
--(void)viewDidLoad
+- (void)viewDidLoad
 {
     _videoView = (WXVideoView *)self.view;
+    _videoView.layer.mask = [self drawBorderRadiusMaskLayer:_videoView.bounds];
     [_videoView setURL:_videoURL];
     [_videoView setPosterURL:_posterURL];
+    
     __weak __typeof__(self) weakSelf = self;
     _videoView.posterClickHandle = ^{
         [weakSelf.videoView play];
diff --git a/ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m 
b/ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m
index 2588a1a9f3..2523bf898b 100644
--- a/ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m
+++ b/ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m
@@ -569,6 +569,22 @@ - (BOOL)_bitmapOpaqueWithSize:(CGSize)size
     return (!hasBorderRadius) && _opacity == 1.0 && 
CGColorGetAlpha(_backgroundColor.CGColor) == 1.0 && [self _needsDrawBorder];
 }
 
+- (CAShapeLayer *)drawBorderRadiusMaskLayer:(CGRect)rect
+{
+    if ([self hasBorderRadiusMaskLayer]) {
+        UIBezierPath *bezierPath = [UIBezierPath 
wx_bezierPathWithRoundedRect:rect topLeft:_borderTopLeftRadius 
topRight:_borderTopRightRadius bottomLeft:_borderBottomLeftRadius 
bottomRight:_borderBottomLeftRadius];
+        CAShapeLayer *maskLayer = [CAShapeLayer layer];
+        maskLayer.path = bezierPath.CGPath;
+        return maskLayer;
+    }
+    return nil;
+}
+
+- (BOOL)hasBorderRadiusMaskLayer
+{
+    return _borderTopLeftRadius > 0.001 || _borderTopRightRadius > 0.001 || 
_borderBottomLeftRadius > 0.001 || _borderBottomLeftRadius > 0.001;
+}
+
 #pragma mark - Deprecated
 
 - (WXDisplayBlock)displayBlock
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXComponent.h 
b/ios/sdk/WeexSDK/Sources/Model/WXComponent.h
index 937d486e98..1799e07942 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXComponent.h
+++ b/ios/sdk/WeexSDK/Sources/Model/WXComponent.h
@@ -405,6 +405,14 @@ NS_ASSUME_NONNULL_BEGIN
  */
 - (UIImage *)endDrawContext:(CGContextRef)context;
 
+/**
+ * @abstract Return a shapelayer when compoent need border radius.(Especially 
video components)
+ *
+ * @discussion You can add this shadelayer to your view.layer attached to 
component.
+ *
+ */
+- (CAShapeLayer *)drawBorderRadiusMaskLayer:(CGRect)rect;
+
 ///--------------------------------------
 /// @name Data Binding
 ///--------------------------------------
@@ -438,7 +446,6 @@ typedef void(^WXDisplayCompletionBlock)(CALayer *layer, 
BOOL finished);
  */
 - (WXDisplayCompletionBlock)displayCompletionBlock 
DEPRECATED_MSG_ATTRIBUTE("use didFinishDrawingLayer: method instead.");
 
-
 @end
 
 @interface UIView (WXComponent)


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> make 'video' and 'videoplus' support border radius
> --------------------------------------------------
>
>                 Key: WEEX-574
>                 URL: https://issues.apache.org/jira/browse/WEEX-574
>             Project: Weex
>          Issue Type: New Feature
>            Reporter: qz
>            Assignee: Adam Feng
>            Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to