facebook / yoga

Yoga is an embeddable layout engine targeting web standards.
https://yogalayout.dev/
MIT License
17.21k stars 1.42k forks source link

[Feature request] support vw&vh units #1097

Open titanseason opened 3 years ago

titanseason commented 3 years ago

Now yoga only support auto percent and point units, Can add support for vw and vh units ?

woehrl01 commented 3 years ago

Hi @titanseason

That's a nice idea and should be fairly easy to implement. A few things need to be done to do that.

  1. Introduce the concept of a viewport. One way to do this is by extending YGConfig.
  2. Extend the API so that you can set this kind of values.
  3. Extend YGResolveValue to work with the values of the viewport to calculate the number.
  4. Write tests to evaluate correct behavior
  5. Check and adapt the algorithm, e.g. YGNodeIsStyleDimDefined and invalidation if the viewport changes.
XantreDev commented 1 year ago

Is it possible to do this without a deep dive into the project? Can I try to implement this?