mirror of
https://github.com/nicbarker/clay.git
synced 2025-11-07 13:26:17 +00:00
Compare commits
5 commits
f1adbe306d
...
3cdb08ae7e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3cdb08ae7e | ||
|
|
588b93196c | ||
|
|
382dcde89d | ||
|
|
c6442bd192 | ||
|
|
6e190427d8 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
12
clay.h
12
clay.h
|
|
@ -1146,6 +1146,7 @@ typedef struct {
|
||||||
Clay_LayoutConfig *layoutConfig;
|
Clay_LayoutConfig *layoutConfig;
|
||||||
Clay__ElementConfigArraySlice elementConfigs;
|
Clay__ElementConfigArraySlice elementConfigs;
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
|
uint16_t floatingChildrenCount;
|
||||||
} Clay_LayoutElement;
|
} Clay_LayoutElement;
|
||||||
|
|
||||||
CLAY__ARRAY_DEFINE(Clay_LayoutElement, Clay_LayoutElementArray)
|
CLAY__ARRAY_DEFINE(Clay_LayoutElement, Clay_LayoutElementArray)
|
||||||
|
|
@ -1776,7 +1777,8 @@ Clay_LayoutElementHashMapItem *Clay__GetHashMapItem(uint32_t id) {
|
||||||
Clay_ElementId Clay__GenerateIdForAnonymousElement(Clay_LayoutElement *openLayoutElement) {
|
Clay_ElementId Clay__GenerateIdForAnonymousElement(Clay_LayoutElement *openLayoutElement) {
|
||||||
Clay_Context* context = Clay_GetCurrentContext();
|
Clay_Context* context = Clay_GetCurrentContext();
|
||||||
Clay_LayoutElement *parentElement = Clay_LayoutElementArray_Get(&context->layoutElements, Clay__int32_tArray_GetValue(&context->openLayoutElementStack, context->openLayoutElementStack.length - 2));
|
Clay_LayoutElement *parentElement = Clay_LayoutElementArray_Get(&context->layoutElements, Clay__int32_tArray_GetValue(&context->openLayoutElementStack, context->openLayoutElementStack.length - 2));
|
||||||
Clay_ElementId elementId = Clay__HashNumber(parentElement->childrenOrTextContent.children.length, parentElement->id);
|
uint32_t offset = parentElement->childrenOrTextContent.children.length + parentElement->floatingChildrenCount;
|
||||||
|
Clay_ElementId elementId = Clay__HashNumber(offset, parentElement->id);
|
||||||
openLayoutElement->id = elementId.id;
|
openLayoutElement->id = elementId.id;
|
||||||
Clay__AddHashMapItem(elementId, openLayoutElement);
|
Clay__AddHashMapItem(elementId, openLayoutElement);
|
||||||
Clay__StringArray_Add(&context->layoutElementIdStrings, elementId.stringId);
|
Clay__StringArray_Add(&context->layoutElementIdStrings, elementId.stringId);
|
||||||
|
|
@ -1917,9 +1919,15 @@ void Clay__CloseElement(void) {
|
||||||
|
|
||||||
// Close the currently open element
|
// Close the currently open element
|
||||||
int32_t closingElementIndex = Clay__int32_tArray_RemoveSwapback(&context->openLayoutElementStack, (int)context->openLayoutElementStack.length - 1);
|
int32_t closingElementIndex = Clay__int32_tArray_RemoveSwapback(&context->openLayoutElementStack, (int)context->openLayoutElementStack.length - 1);
|
||||||
|
|
||||||
|
// Get the currently open parent
|
||||||
openLayoutElement = Clay__GetOpenLayoutElement();
|
openLayoutElement = Clay__GetOpenLayoutElement();
|
||||||
|
|
||||||
if (!elementIsFloating && context->openLayoutElementStack.length > 1) {
|
if (context->openLayoutElementStack.length > 1) {
|
||||||
|
if(elementIsFloating) {
|
||||||
|
openLayoutElement->floatingChildrenCount++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
openLayoutElement->childrenOrTextContent.children.length++;
|
openLayoutElement->childrenOrTextContent.children.length++;
|
||||||
Clay__int32_tArray_Add(&context->layoutElementChildrenBuffer, closingElementIndex);
|
Clay__int32_tArray_Add(&context->layoutElementChildrenBuffer, closingElementIndex);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -500,9 +500,6 @@
|
||||||
|
|
||||||
let linkContents = customData.link.length.value > 0 ? textDecoder.decode(new Uint8Array(memoryDataView.buffer.slice(customData.link.chars.value, customData.link.chars.value + customData.link.length.value))) : 0;
|
let linkContents = customData.link.length.value > 0 ? textDecoder.decode(new Uint8Array(memoryDataView.buffer.slice(customData.link.chars.value, customData.link.chars.value + customData.link.length.value))) : 0;
|
||||||
memoryDataView.setUint32(0, renderCommand.id.value, true);
|
memoryDataView.setUint32(0, renderCommand.id.value, true);
|
||||||
if (linkContents.length > 0 && (window.mouseDownThisFrame || window.touchDown) && instance.exports.Clay_PointerOver(0)) {
|
|
||||||
window.location.href = linkContents;
|
|
||||||
}
|
|
||||||
if (linkContents.length > 0) {
|
if (linkContents.length > 0) {
|
||||||
element.href = linkContents;
|
element.href = linkContents;
|
||||||
}
|
}
|
||||||
|
|
@ -567,9 +564,6 @@
|
||||||
element.style.pointerEvents = customData.disablePointerEvents.value ? 'none' : 'all';
|
element.style.pointerEvents = customData.disablePointerEvents.value ? 'none' : 'all';
|
||||||
let linkContents = customData.link.length.value > 0 ? textDecoder.decode(new Uint8Array(memoryDataView.buffer.slice(customData.link.chars.value, customData.link.chars.value + customData.link.length.value))) : 0;
|
let linkContents = customData.link.length.value > 0 ? textDecoder.decode(new Uint8Array(memoryDataView.buffer.slice(customData.link.chars.value, customData.link.chars.value + customData.link.length.value))) : 0;
|
||||||
memoryDataView.setUint32(0, renderCommand.id.value, true);
|
memoryDataView.setUint32(0, renderCommand.id.value, true);
|
||||||
if (linkContents.length > 0 && (window.mouseDownThisFrame || window.touchDown) && instance.exports.Clay_PointerOver(0)) {
|
|
||||||
window.location.href = linkContents;
|
|
||||||
}
|
|
||||||
if (linkContents.length > 0) {
|
if (linkContents.length > 0) {
|
||||||
element.href = linkContents;
|
element.href = linkContents;
|
||||||
}
|
}
|
||||||
|
|
@ -854,4 +848,4 @@
|
||||||
</script>
|
</script>
|
||||||
<body>
|
<body>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -500,9 +500,6 @@
|
||||||
|
|
||||||
let linkContents = customData.link.length.value > 0 ? textDecoder.decode(new Uint8Array(memoryDataView.buffer.slice(customData.link.chars.value, customData.link.chars.value + customData.link.length.value))) : 0;
|
let linkContents = customData.link.length.value > 0 ? textDecoder.decode(new Uint8Array(memoryDataView.buffer.slice(customData.link.chars.value, customData.link.chars.value + customData.link.length.value))) : 0;
|
||||||
memoryDataView.setUint32(0, renderCommand.id.value, true);
|
memoryDataView.setUint32(0, renderCommand.id.value, true);
|
||||||
if (linkContents.length > 0 && (window.mouseDownThisFrame || window.touchDown) && instance.exports.Clay_PointerOver(0)) {
|
|
||||||
window.location.href = linkContents;
|
|
||||||
}
|
|
||||||
if (linkContents.length > 0) {
|
if (linkContents.length > 0) {
|
||||||
element.href = linkContents;
|
element.href = linkContents;
|
||||||
}
|
}
|
||||||
|
|
@ -567,9 +564,6 @@
|
||||||
element.style.pointerEvents = customData.disablePointerEvents.value ? 'none' : 'all';
|
element.style.pointerEvents = customData.disablePointerEvents.value ? 'none' : 'all';
|
||||||
let linkContents = customData.link.length.value > 0 ? textDecoder.decode(new Uint8Array(memoryDataView.buffer.slice(customData.link.chars.value, customData.link.chars.value + customData.link.length.value))) : 0;
|
let linkContents = customData.link.length.value > 0 ? textDecoder.decode(new Uint8Array(memoryDataView.buffer.slice(customData.link.chars.value, customData.link.chars.value + customData.link.length.value))) : 0;
|
||||||
memoryDataView.setUint32(0, renderCommand.id.value, true);
|
memoryDataView.setUint32(0, renderCommand.id.value, true);
|
||||||
if (linkContents.length > 0 && (window.mouseDownThisFrame || window.touchDown) && instance.exports.Clay_PointerOver(0)) {
|
|
||||||
window.location.href = linkContents;
|
|
||||||
}
|
|
||||||
if (linkContents.length > 0) {
|
if (linkContents.length > 0) {
|
||||||
element.href = linkContents;
|
element.href = linkContents;
|
||||||
}
|
}
|
||||||
|
|
@ -854,4 +848,4 @@
|
||||||
</script>
|
</script>
|
||||||
<body>
|
<body>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ set(FETCHCONTENT_QUIET FALSE)
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
termbox2
|
termbox2
|
||||||
GIT_REPOSITORY "https://github.com/termbox/termbox2.git"
|
GIT_REPOSITORY "https://github.com/termbox/termbox2.git"
|
||||||
GIT_TAG "9c9281a9a4c971a2be57f8645e828ec99fd555e8"
|
GIT_TAG "ffd159c2a6106dd5eef338a6702ad15d4d4aa809"
|
||||||
GIT_PROGRESS TRUE
|
GIT_PROGRESS TRUE
|
||||||
GIT_SHALLOW TRUE
|
GIT_SHALLOW TRUE
|
||||||
)
|
)
|
||||||
|
|
@ -19,7 +19,7 @@ FetchContent_MakeAvailable(termbox2)
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
stb
|
stb
|
||||||
GIT_REPOSITORY "https://github.com/nothings/stb.git"
|
GIT_REPOSITORY "https://github.com/nothings/stb.git"
|
||||||
GIT_TAG "f58f558c120e9b32c217290b80bad1a0729fbb2c"
|
GIT_TAG "fede005abaf93d9d7f3a679d1999b2db341b360f"
|
||||||
GIT_PROGRESS TRUE
|
GIT_PROGRESS TRUE
|
||||||
GIT_SHALLOW TRUE
|
GIT_SHALLOW TRUE
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -394,9 +394,6 @@
|
||||||
let configMemory = new Uint8Array(memoryDataView.buffer.slice(renderCommand.config.value, renderCommand.config.value + config.__size));
|
let configMemory = new Uint8Array(memoryDataView.buffer.slice(renderCommand.config.value, renderCommand.config.value + config.__size));
|
||||||
let linkContents = config.link.length.value > 0 ? textDecoder.decode(new Uint8Array(memoryDataView.buffer.slice(config.link.chars.value, config.link.chars.value + config.link.length.value))) : 0;
|
let linkContents = config.link.length.value > 0 ? textDecoder.decode(new Uint8Array(memoryDataView.buffer.slice(config.link.chars.value, config.link.chars.value + config.link.length.value))) : 0;
|
||||||
memoryDataView.setUint32(0, renderCommand.id.value, true);
|
memoryDataView.setUint32(0, renderCommand.id.value, true);
|
||||||
if (linkContents.length > 0 && (window.mouseDownThisFrame || window.touchDown) && instance.exports.Clay_PointerOver(0)) {
|
|
||||||
window.location.href = linkContents;
|
|
||||||
}
|
|
||||||
if (!dirty && !MemoryIsDifferent(configMemory, elementData.previousMemoryConfig, config.__size)) {
|
if (!dirty && !MemoryIsDifferent(configMemory, elementData.previousMemoryConfig, config.__size)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -528,4 +525,4 @@
|
||||||
<body>
|
<body>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue