YGSize is not equal to CGSize #706

Closed
opened 2018-02-01 19:23:29 -08:00 by djs66256 · 2 comments
djs66256 commented 2018-02-01 19:23:29 -08:00 (Migrated from github.com)

Report

Issues and Steps to Reproduce

In iOS:

struct CGSize {
    CGFloat width;
    CGFloat height;
};

And in Yoga:

typedef struct YGSize {
  float width;
  float height;
} YGSize;

Because CGFloat is double, it will cause a precision lost.

66045bd13d/YogaKit/Source/YGLayout.m (L277)

Even if I set the width and height of the root node explicitly, it may return the different size. And apply it to the view. Then call layoutSubviews.

It will support double instead of float? Or can choose by myself.

# Report - [x] I have searched [existing issues](https://github.com/facebook/yoga/issues) and this is not a duplicate # Issues and Steps to Reproduce In iOS: ```c struct CGSize { CGFloat width; CGFloat height; }; ``` And in Yoga: ```c typedef struct YGSize { float width; float height; } YGSize; ``` Because `CGFloat` is double, it will cause a precision lost. https://github.com/facebook/yoga/blob/66045bd13dcaa9108249ce5c2b6a1b84838b750d/YogaKit/Source/YGLayout.m#L277 Even if I set the `width` and `height` of the root node explicitly, it may return the different size. And apply it to the view. Then call `layoutSubviews`. It will support `double` instead of `float`? Or can choose by myself.
cntrump commented 2020-08-15 06:43:48 -07:00 (Migrated from github.com)

I defined YGFloat like CGFloat. PR https://github.com/facebook/yoga/pull/1026

typedef struct YGSize {
  YGFloat width;
  YGFloat height;
} YGSize;
I defined `YGFloat` like `CGFloat`. PR https://github.com/facebook/yoga/pull/1026 ```c typedef struct YGSize { YGFloat width; YGFloat height; } YGSize; ```
NickGerleman commented 2023-06-13 08:05:36 -07:00 (Migrated from github.com)

We are deprecating YogaKit as part of the Yoga 2.0 release. We are still going to release a new revision based on the current state of the repo, but won't be accepting new contributions, since we are going to be removing it from the repo after.

We are deprecating YogaKit as part of the Yoga 2.0 release. We are still going to release a new revision based on the current state of the repo, but won't be accepting new contributions, since we are going to be removing it from the repo after.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DaddyFrosty/yoga#706
No description provided.