Repository navigation
v0.1.4
Builds on v0.1.3.
This release contains a breaking layout change. A Box with two or more children now layers them instead of flowing them top to bottom. See Migration below.
Breaking: Box is a z-stack
Up to v0.1.3 Box mapped to CLAY_TOP_TO_BOTTOM, the same as Column. Children were only layered when each one set .floating, which Text and the progress components do not accept.
Box now layers its children in declaration order, with the last one on top. .layout.padding and .layout.childAlignment apply to every layer.
Box("Timer",
.layout = {.sizing = {Fixed(200), Fixed(200)},
.childAlignment = {.x = CC_ALIGN_X_CENTER,
.y = CC_ALIGN_Y_CENTER}}) {
CircularProgress(0.75f, .sizing = {Grow(), Grow()});
Text("24:59", .fontSize = 40); // centered over the ring
}Clay has no z-stack layout mode, so Box builds one. The first child stays in normal flow, and every later child is wrapped in a floating layer the size of the box.
- A
Fit()box takes its size from its first child. Put the largest layer first, or give the box an explicit size. - Layers let the pointer through, so a
Buttonunder a later layer still gets its hover and click. - A child that sets its own
.floatingis left alone, for a custom attach point, offset orzIndex. .layout.childGaphas no effect on aBox.
Migration
- A
Boxwith zero or one child needs no change. - A
Boxwhose children all set.floatingneeds no change. - A
Boxthat relied on its children flowing top to bottom becomes aColumn. Drawkeeps its top-to-bottom children. It is now built onColumn.
Other changes
Textexpands to a call toCC__Textinstead of callingClay__OpenTextElementdirectly. Call sites are unchanged.- New headless test
ccompose_box_test.
Using it
FetchContent_Declare(ccompose
GIT_REPOSITORY https://github.com/rizukirr/ccompose.git
GIT_TAG v0.1.4
GIT_SHALLOW TRUE
)