[YogaKit] support macOS, tvOS, Carthage; auto apply layout like AutoLayout. #1026
@@ -522,8 +522,8 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) {
|
||||
} : CGPointZero;
|
||||
|
||||
const CGPoint bottomRight = {
|
||||
topLeft.x + YGNodeLayoutGetWidth(node),
|
||||
topLeft.y + YGNodeLayoutGetHeight(node),
|
||||
.x = (CGFloat)(topLeft.x + YGNodeLayoutGetWidth(node)),
|
||||
.y = (CGFloat)(topLeft.y + YGNodeLayoutGetHeight(node)),
|
||||
};
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
@@ -531,8 +531,8 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) {
|
||||
#else
|
||||
// use bounds/center and not frame if non-identity transform.
|
||||
const CGPoint origin = preserveOrigin ? (CGPoint) {
|
||||
.x = view.center.x - CGRectGetWidth(view.bounds) * 0.5,
|
||||
.y = view.center.y - CGRectGetHeight(view.bounds) * 0.5
|
||||
.x = (CGFloat)(view.center.x - CGRectGetWidth(view.bounds) * 0.5),
|
||||
.y = (CGFloat)(view.center.y - CGRectGetHeight(view.bounds) * 0.5)
|
||||
}
|
||||
: CGPointZero;
|
||||
#endif
|
||||
@@ -552,7 +552,7 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) {
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
if (!view.superview.isFlipped && view.superview.isYogaEnabled && view.superview.yoga.isEnabled) {
|
||||
frame.origin.y = YGNodeLayoutGetHeight(view.superview.yoga.node) - CGRectGetMaxY(frame);
|
||||
frame.origin.y = (CGFloat)(YGNodeLayoutGetHeight(view.superview.yoga.node) - CGRectGetMaxY(frame));
|
||||
}
|
||||
|
||||
view.frame = (CGRect) {
|
||||
@@ -566,8 +566,8 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) {
|
||||
};
|
||||
|
||||
view.center = (CGPoint) {
|
||||
.x = CGRectGetMinX(frame) + CGRectGetWidth(frame) * 0.5,
|
||||
.y = CGRectGetMinY(frame) + CGRectGetHeight(frame) * 0.5
|
||||
.x = (CGFloat)(CGRectGetMinX(frame) + CGRectGetWidth(frame) * 0.5),
|
||||
.y = (CGFloat)(CGRectGetMinY(frame) + CGRectGetHeight(frame) * 0.5)
|
||||
};
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user