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