You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by gu...@apache.org on 2017/10/17 08:25:50 UTC

[37/50] incubator-weex git commit: * [ios] fix issue https://issues.apache.org/jira/browse/WEEX-81 that box-shadow is abnormal in border-radius

* [ios] fix issue https://issues.apache.org/jira/browse/WEEX-81  that box-shadow is abnormal in border-radius


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/dea22e93
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/dea22e93
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/dea22e93

Branch: refs/heads/release-0.16
Commit: dea22e93d70e98f26bf5ceea8720dc0d96514d17
Parents: 12a978d
Author: acton393 <zh...@gmail.com>
Authored: Fri Oct 13 16:35:03 2017 +0800
Committer: gurisxie <27...@qq.com>
Committed: Mon Oct 16 14:27:12 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.m | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/dea22e93/ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.m b/ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.m
index a72e556..fb0c0b3 100644
--- a/ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.m
+++ b/ios/sdk/WeexSDK/Sources/Display/WXComponent+BoxShadow.m
@@ -22,6 +22,8 @@
 #import "WXConvert.h"
 #import "WXUtility.h"
 #import "WXComponent_internal.h"
+#import "UIBezierPath+Weex.h"
+#import "WXRoundedRect.h"
 
 @implementation WXComponent (BoxShadow)
 
@@ -81,15 +83,20 @@
     if (!boxShadow) {
         return;
     }
+    WXRoundedRect *borderRect = [[WXRoundedRect alloc] initWithRect:self.view.bounds topLeft:_borderTopLeftRadius topRight:_borderTopRightRadius bottomLeft:_borderBottomLeftRadius bottomRight:_borderBottomRightRadius];
+    // here is computed radii, do not use original style
+    WXRadii *radii = borderRect.radii;
+    CGFloat topLeft = radii.topLeft, topRight = radii.topRight, bottomLeft = radii.bottomLeft, bottomRight = radii.bottomRight;
+    UIBezierPath *shadowPath = [UIBezierPath wx_bezierPathWithRoundedRect:self.view.bounds topLeft:topLeft topRight:topRight bottomLeft:bottomLeft bottomRight:bottomRight];
     if (boxShadow.isInset) {
         if (boxShadow.innerLayer) {
             boxShadow.innerLayer.frame = self.view.bounds;
             if (![boxShadow.innerLayer superlayer] ){
+                self.view.layer.masksToBounds = YES;
                 [self.view.layer addSublayer:boxShadow.innerLayer];
             }
         }
     } else {
-        UIBezierPath *shadowPath = [UIBezierPath bezierPathWithRect:self.view.bounds];
         self.view.layer.masksToBounds = NO;
         self.view.layer.shadowColor = boxShadow.shadowColor.CGColor;
         self.view.layer.shadowOffset = boxShadow.shadowOffset;