feat:fix transform and layoutcontainer conflict
This commit is contained in:
@@ -129,28 +129,33 @@ - (CGSize)sizeContent:(CGSize)size {
|
||||
if (child.isHidden) {
|
||||
continue;
|
||||
}
|
||||
|
||||
DoricLayoutConfig *childConfig = child.layoutConfig;
|
||||
if (!childConfig) {
|
||||
childConfig = [DoricLayoutConfig new];
|
||||
}
|
||||
CGSize childSize = CGSizeMake(child.width, child.height);
|
||||
if ([child isKindOfClass:[DoricLayoutContainer class]]
|
||||
|| childConfig.widthSpec == DoricLayoutWrapContent
|
||||
|| childConfig.heightSpec == DoricLayoutWrapContent) {
|
||||
childSize = [child sizeThatFits:CGSizeMake(size.width, size.height - contentHeight)];
|
||||
}
|
||||
if (childConfig.widthSpec == DoricLayoutExact) {
|
||||
childSize.width = child.width;
|
||||
} else if (childConfig.widthSpec == DoricLayoutAtMost) {
|
||||
childSize.width = size.width;
|
||||
}
|
||||
if (childConfig.heightSpec == DoricLayoutExact) {
|
||||
childSize.height = child.height;
|
||||
} else if (childConfig.heightSpec == DoricLayoutAtMost) {
|
||||
childSize.height = size.height - contentHeight;
|
||||
}
|
||||
if (childConfig.weight) {
|
||||
childSize.height = child.height;
|
||||
if (CGAffineTransformEqualToTransform(child.transform, CGAffineTransformIdentity)) {
|
||||
if ([child isKindOfClass:[DoricLayoutContainer class]]
|
||||
|| childConfig.widthSpec == DoricLayoutWrapContent
|
||||
|| childConfig.heightSpec == DoricLayoutWrapContent) {
|
||||
childSize = [child sizeThatFits:CGSizeMake(size.width, size.height - contentHeight)];
|
||||
}
|
||||
if (childConfig.widthSpec == DoricLayoutExact) {
|
||||
childSize.width = child.width;
|
||||
} else if (childConfig.widthSpec == DoricLayoutAtMost) {
|
||||
childSize.width = size.width;
|
||||
}
|
||||
if (childConfig.heightSpec == DoricLayoutExact) {
|
||||
childSize.height = child.height;
|
||||
} else if (childConfig.heightSpec == DoricLayoutAtMost) {
|
||||
childSize.height = size.height - contentHeight;
|
||||
}
|
||||
if (childConfig.weight) {
|
||||
childSize.height = child.height;
|
||||
}
|
||||
} else {
|
||||
childSize = child.bounds.size;
|
||||
}
|
||||
contentWidth = MAX(contentWidth, childSize.width + childConfig.margin.left + childConfig.margin.right);
|
||||
contentHeight = MAX(contentHeight, childSize.height + childConfig.margin.top + childConfig.margin.bottom);
|
||||
@@ -167,6 +172,9 @@ - (void)layout:(CGSize)targetSize {
|
||||
if (child.isHidden) {
|
||||
continue;
|
||||
}
|
||||
if (!CGAffineTransformEqualToTransform(child.transform, CGAffineTransformIdentity)) {
|
||||
continue;
|
||||
}
|
||||
DoricLayoutConfig *childConfig = child.layoutConfig;
|
||||
if (!childConfig) {
|
||||
childConfig = [DoricLayoutConfig new];
|
||||
@@ -246,23 +254,27 @@ - (CGSize)sizeContent:(CGSize)size {
|
||||
childConfig = [DoricLayoutConfig new];
|
||||
}
|
||||
CGSize childSize = CGSizeMake(child.width, child.height);
|
||||
if ([child isKindOfClass:[DoricLayoutContainer class]]
|
||||
|| childConfig.widthSpec == DoricLayoutWrapContent
|
||||
|| childConfig.heightSpec == DoricLayoutWrapContent) {
|
||||
childSize = [child sizeThatFits:CGSizeMake(size.width, size.height - contentHeight)];
|
||||
}
|
||||
if (childConfig.widthSpec == DoricLayoutExact) {
|
||||
childSize.width = child.width;
|
||||
} else if (childConfig.widthSpec == DoricLayoutAtMost) {
|
||||
childSize.width = size.width;
|
||||
}
|
||||
if (childConfig.heightSpec == DoricLayoutExact) {
|
||||
childSize.height = child.height;
|
||||
} else if (childConfig.heightSpec == DoricLayoutAtMost) {
|
||||
childSize.height = size.height - contentHeight;
|
||||
}
|
||||
if (childConfig.weight) {
|
||||
childSize.height = child.height;
|
||||
if (CGAffineTransformEqualToTransform(child.transform, CGAffineTransformIdentity)) {
|
||||
if ([child isKindOfClass:[DoricLayoutContainer class]]
|
||||
|| childConfig.widthSpec == DoricLayoutWrapContent
|
||||
|| childConfig.heightSpec == DoricLayoutWrapContent) {
|
||||
childSize = [child sizeThatFits:CGSizeMake(size.width, size.height - contentHeight)];
|
||||
}
|
||||
if (childConfig.widthSpec == DoricLayoutExact) {
|
||||
childSize.width = child.width;
|
||||
} else if (childConfig.widthSpec == DoricLayoutAtMost) {
|
||||
childSize.width = size.width;
|
||||
}
|
||||
if (childConfig.heightSpec == DoricLayoutExact) {
|
||||
childSize.height = child.height;
|
||||
} else if (childConfig.heightSpec == DoricLayoutAtMost) {
|
||||
childSize.height = size.height - contentHeight;
|
||||
}
|
||||
if (childConfig.weight) {
|
||||
childSize.height = child.height;
|
||||
}
|
||||
} else {
|
||||
childSize = child.bounds.size;
|
||||
}
|
||||
contentWidth = MAX(contentWidth, childSize.width + childConfig.margin.left + childConfig.margin.right);
|
||||
contentHeight += childSize.height + self.space + childConfig.margin.top + childConfig.margin.bottom;
|
||||
@@ -294,6 +306,9 @@ - (void)layout:(CGSize)targetSize {
|
||||
if (child.isHidden) {
|
||||
continue;
|
||||
}
|
||||
if (!CGAffineTransformEqualToTransform(child.transform, CGAffineTransformIdentity)) {
|
||||
continue;
|
||||
}
|
||||
DoricLayoutConfig *childConfig = child.layoutConfig;
|
||||
if (!childConfig) {
|
||||
childConfig = [DoricLayoutConfig new];
|
||||
@@ -371,24 +386,29 @@ - (CGSize)sizeContent:(CGSize)size {
|
||||
childConfig = [DoricLayoutConfig new];
|
||||
}
|
||||
CGSize childSize = CGSizeMake(child.width, child.height);
|
||||
if ([child isKindOfClass:[DoricLayoutContainer class]]
|
||||
|| childConfig.widthSpec == DoricLayoutWrapContent
|
||||
|| childConfig.heightSpec == DoricLayoutWrapContent) {
|
||||
childSize = [child sizeThatFits:CGSizeMake(size.width - contentWidth, size.height)];
|
||||
}
|
||||
if (childConfig.widthSpec == DoricLayoutExact) {
|
||||
childSize.width = child.width;
|
||||
} else if (childConfig.widthSpec == DoricLayoutAtMost) {
|
||||
childSize.width = size.width - contentWidth;
|
||||
}
|
||||
if (childConfig.heightSpec == DoricLayoutExact) {
|
||||
childSize.height = child.height;
|
||||
} else if (childConfig.heightSpec == DoricLayoutAtMost) {
|
||||
childSize.height = size.height;
|
||||
}
|
||||
if (childConfig.weight) {
|
||||
childSize.width = child.width;
|
||||
if (CGAffineTransformEqualToTransform(child.transform, CGAffineTransformIdentity)) {
|
||||
if ([child isKindOfClass:[DoricLayoutContainer class]]
|
||||
|| childConfig.widthSpec == DoricLayoutWrapContent
|
||||
|| childConfig.heightSpec == DoricLayoutWrapContent) {
|
||||
childSize = [child sizeThatFits:CGSizeMake(size.width - contentWidth, size.height)];
|
||||
}
|
||||
if (childConfig.widthSpec == DoricLayoutExact) {
|
||||
childSize.width = child.width;
|
||||
} else if (childConfig.widthSpec == DoricLayoutAtMost) {
|
||||
childSize.width = size.width - contentWidth;
|
||||
}
|
||||
if (childConfig.heightSpec == DoricLayoutExact) {
|
||||
childSize.height = child.height;
|
||||
} else if (childConfig.heightSpec == DoricLayoutAtMost) {
|
||||
childSize.height = size.height;
|
||||
}
|
||||
if (childConfig.weight) {
|
||||
childSize.width = child.width;
|
||||
}
|
||||
} else {
|
||||
childSize = child.bounds.size;
|
||||
}
|
||||
|
||||
contentWidth += childSize.width + self.space + childConfig.margin.left + childConfig.margin.right;
|
||||
contentHeight = MAX(contentHeight, childSize.height + childConfig.margin.top + childConfig.margin.bottom);
|
||||
contentWeight += childConfig.weight;
|
||||
@@ -421,6 +441,9 @@ - (void)layout:(CGSize)targetSize {
|
||||
if (child.isHidden) {
|
||||
continue;
|
||||
}
|
||||
if (!CGAffineTransformEqualToTransform(child.transform, CGAffineTransformIdentity)) {
|
||||
continue;
|
||||
}
|
||||
DoricLayoutConfig *childConfig = child.layoutConfig;
|
||||
if (!childConfig) {
|
||||
childConfig = [DoricLayoutConfig new];
|
||||
|
@@ -233,7 +233,11 @@ - (NSNumber *)getHeight {
|
||||
}
|
||||
|
||||
- (void)setRotation:(NSNumber *)rotation {
|
||||
self.view.transform = CGAffineTransformRotate(self.view.transform, M_PI * rotation.floatValue * 2);
|
||||
if (rotation.floatValue == 0) {
|
||||
self.view.transform = CGAffineTransformIdentity;
|
||||
} else {
|
||||
self.view.transform = CGAffineTransformMakeRotation(M_PI * rotation.floatValue * 2);
|
||||
}
|
||||
}
|
||||
|
||||
- (NSNumber *)getRotation {
|
||||
|
Reference in New Issue
Block a user