iOS:DoricLayout use marginLeft and marginTop instead of x or y

This commit is contained in:
pengfei.zhou 2020-04-08 15:47:10 +08:00 committed by osborn
parent 2a7c7bd27d
commit e689d52f26
3 changed files with 4 additions and 8 deletions

View File

@ -65,8 +65,6 @@ typedef NS_ENUM(NSInteger, DoricGravity) {
@property(nonatomic, assign) CGFloat width;
@property(nonatomic, assign) CGFloat height;
@property(nonatomic, assign) CGFloat x;
@property(nonatomic, assign) CGFloat y;
@property(nonatomic, assign) CGFloat spacing;

View File

@ -37,8 +37,6 @@ - (DoricLayout *)doricLayout {
layout = [DoricLayout new];
layout.width = self.width;
layout.height = self.height;
layout.x = self.x;
layout.y = self.y;
layout.view = self;
self.doricLayout = layout;
}
@ -360,7 +358,7 @@ - (void)layoutStack {
if (layout.marginLeft || layout.marginRight) {
layout.measuredX = self.paddingLeft;
} else {
layout.measuredX = layout.x;
layout.measuredX = 0;
}
}
if ((gravity & DoricGravityTop) == DoricGravityTop) {
@ -373,7 +371,7 @@ - (void)layoutStack {
if (layout.marginTop || layout.marginBottom) {
layout.measuredY = self.paddingTop;
} else {
layout.measuredY = layout.y;
layout.measuredY = 0;
}
}

View File

@ -173,9 +173,9 @@ - (void)blendView:(UIView *)view forPropName:(NSString *)name propValue:(id)prop
} else if ([name isEqualToString:@"height"]) {
view.doricLayout.height = [prop floatValue];
} else if ([name isEqualToString:@"x"]) {
view.doricLayout.x = [prop floatValue];
view.doricLayout.marginLeft = [prop floatValue];
} else if ([name isEqualToString:@"y"]) {
view.doricLayout.y = [prop floatValue];
view.doricLayout.marginTop = [prop floatValue];
} else if ([name isEqualToString:@"backgroundColor"]) {
if ([prop isKindOfClass:[NSNumber class]]) {
view.backgroundColor = DoricColor(prop);