lume / autolayout

Apple's Auto Layout and Visual Format Language for JavaScript (using cassowary constraints)
MIT License
307 stars 11 forks source link

how to make a view fill the space between 2 views to which it is constrained using VFL/EVFL #1

Closed gbenroscience closed 1 year ago

gbenroscience commented 2 years ago

Thanks a whole lot for this library.

I am constraining a view between 2 others. Say, view V is between views A and B. Let's say A is to the left and B is to the right.(Or A is to the top and B is to the bottom) I want view V to fill the space between A and B totally. I am using EVFL. How can I accomplish this, please.

Thanks.

trusktr commented 1 year ago

Hello! Sorry for the very late response. I hope you figured it out:

H:|-[A(200)]-[V]-[B(100)]-|

^ In this example, A is on the left edge and has width 200, B is on the right edge and has width 100, and V is in the middle and takes up the remaining space.

Here is the full horizontal demo (paste it into the playground):

H:|-[A(200)]-[V]-[B(100)]|
V:|-[A]-|
V:|-[V]-|
V:|-[B]-|

Here is the full horizontal demo (just swap H: and V:):

V:|-[A(200)]-[V]-[B(100)]|
H:|-[A]-|
H:|-[V]-|
H:|-[B]-|