Commit b6039ce
Add constrainedSize modifier
Summary:
Adds a new constrainedSize(maxWidth:maxHeight:) modifier to QuickLayout that clamps the parent's proposed size before measuring the child.
Unlike .frame(maxWidth:maxHeight:) (FlexibleFrame), this modifier does not create an invisible frame around the child or reposition it with alignment. It simply constrains the proposed size passed to the child and reports the child's actual size as its own. This makes it useful when you want to limit how much space a child is offered without introducing extra layout space around it.
The new ConstrainedSizeElement is modeled after FixedFrameElement but differs in three key ways:
Reports the child's actual size rather than the frame's size
Delegates flexibility to the child instead of reporting .fixedSize
Does not perform alignment positioning — the child is placed at the origin
Reviewed By: xavierjurado
Differential Revision: D94706249
fbshipit-source-id: 26f6a505c64a65964478d2c915962b9bc37c1b6c1 parent e7caec9 commit b6039ce
6 files changed
Lines changed: 561 additions & 0 deletions
File tree
- Sources/QuickLayout
- QuickLayoutBridge
- __server_snapshot_tests__
- QuickLayoutCore/LayoutPrimitives
- docs
- docs/layout
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
198 | 206 | | |
199 | 207 | | |
200 | 208 | | |
| |||
0 commit comments