Switch floating containers to opt in

This commit is contained in:
Nic Barker 2025-02-04 08:55:28 +13:00
parent d08b04a09d
commit d0d96777a6
9 changed files with 56 additions and 73 deletions

View file

@ -147,15 +147,15 @@ ScrollElementConfig :: struct {
}
FloatingAttachPointType :: enum EnumBackingType {
LEFT_TOP,
LEFT_CENTER,
LEFT_BOTTOM,
CENTER_TOP,
CENTER_CENTER,
CENTER_BOTTOM,
RIGHT_TOP,
RIGHT_CENTER,
RIGHT_BOTTOM,
LeftTop,
LeftCenter,
LeftBottom,
CenterTop,
CenterCenter,
CenterBottom,
RightTop,
RightCenter,
RightBottom,
}
FloatingAttachPoints :: struct {
@ -164,8 +164,15 @@ FloatingAttachPoints :: struct {
}
PointerCaptureMode :: enum EnumBackingType {
CAPTURE,
PASSTHROUGH,
Capture,
Passthrough,
}
FloatingAttachToElement :: enum EnumBackingType {
None,
Parent,
ElementWithId,
Root,
}
FloatingElementConfig :: struct {
@ -175,6 +182,7 @@ FloatingElementConfig :: struct {
zIndex: i32,
attachment: FloatingAttachPoints,
pointerCaptureMode: PointerCaptureMode,
attachTo: FloatingAttachToElement
}
TextRenderData :: struct {

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -93,7 +93,7 @@ LandingPageDesktop :: proc() {
"Clay is a flex-box style UI auto layout library in C, with declarative syntax and microsecond performance.",
clay.TextConfig({fontSize = 56, fontId = FONT_ID_TITLE_56, textColor = COLOR_RED}),
)
// if clay.UI().configure(layout = {sizing = {width = clay.SizingGrow({}), height = clay.SizingFixed(32)}})) {}
if clay.UI().configure({ layout = { sizing = { width = clay.SizingGrow({}), height = clay.SizingFixed(32) } } }) {}
clay.Text(
"Clay is laying out this webpage right now!",
clay.TextConfig({fontSize = 36, fontId = FONT_ID_TITLE_36, textColor = COLOR_ORANGE}),
@ -175,7 +175,7 @@ FeatureBlocksDesktop :: proc() {
if clay.UI().configure({
id = clay.ID("FeatureBlocksInner"),
layout = { sizing = { width = clay.SizingGrow({ }) }, childAlignment = { y = .CENTER } },
border = border2pxRed,
border = { width = { betweenChildren = 2}, color = COLOR_RED },
}) {
FeatureBlocks(clay.SizingPercent(0.5), 50)
}
@ -186,7 +186,7 @@ FeatureBlocksMobile :: proc() {
if clay.UI().configure({
id = clay.ID("FeatureBlocksInner"),
layout = { layoutDirection = .TOP_TO_BOTTOM, sizing = { width = clay.SizingGrow({ }) } },
border = border2pxRed,
border = { width = { betweenChildren = 2}, color = COLOR_RED },
}) {
FeatureBlocks(clay.SizingGrow({}), 16)
}