From 1370cd7ff27bd737bfdc36045a24e53509f41bb1 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Thu, 8 Dec 2016 11:00:03 -0600 Subject: [PATCH] Fix inverted coord space issue with XM sample --- .../mac/Facebook.Yoga.Mac.Test/ViewController.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/csharp/Facebook.Yoga/mac/Facebook.Yoga.Mac.Test/ViewController.cs b/csharp/Facebook.Yoga/mac/Facebook.Yoga.Mac.Test/ViewController.cs index 3e1a6b1b..b91a2e3d 100644 --- a/csharp/Facebook.Yoga/mac/Facebook.Yoga.Mac.Test/ViewController.cs +++ b/csharp/Facebook.Yoga/mac/Facebook.Yoga.Mac.Test/ViewController.cs @@ -14,7 +14,8 @@ namespace Facebook.Yoga.Mac.Test // This assumes your YogaNode and NSView children were inserted in same order for (int i = 0; i < n.Count; ++i) { YogaNode childNode = n[i]; - view.Subviews[i].Frame = new CGRect (childNode.LayoutX, childNode.LayoutY, childNode.LayoutWidth, childNode.LayoutHeight); + // Cocoa coord space is from bottom left not top left + view.Subviews[i].Frame = new CGRect (childNode.LayoutX, n.LayoutHeight - childNode.LayoutY - childNode.LayoutHeight, childNode.LayoutWidth, childNode.LayoutHeight); } } } @@ -66,12 +67,14 @@ namespace Facebook.Yoga.Mac.Test var imageNode = new YogaNode () { Width = (float)imageSize.Width, + Height = (float)imageSize.Height, }; imageNode.SetMargin (YogaEdge.End, 20); var textNode = new YogaNode () { AlignSelf = YogaAlign.Center, FlexGrow = 1, + Height = 60, }; rootNode.Insert (0, imageNode); rootNode.Insert (1, textNode);