mirror of
https://github.com/nicbarker/clay.git
synced 2025-01-23 01:46:02 +00:00
[Core] Add API to query element bounding boxes (#199)
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Waiting to run
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Failing after 12s
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Failing after 13s
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Waiting to run
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Failing after 12s
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Failing after 13s
Co-authored-by: hexmaster111 <hailey@not-an-email-address.fake>
This commit is contained in:
parent
338852b3ce
commit
814c9392c6
21
clay.h
21
clay.h
@ -443,6 +443,13 @@ CLAY__TYPEDEF(Clay_ScrollContainerData, struct {
|
|||||||
bool found;
|
bool found;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
CLAY__TYPEDEF(Clay_ElementData, struct
|
||||||
|
{
|
||||||
|
Clay_BoundingBox boundingBox;
|
||||||
|
// Indicates whether an actual Element matched the provided ID or if the default struct was returned.
|
||||||
|
bool found;
|
||||||
|
});
|
||||||
|
|
||||||
CLAY__TYPEDEF(Clay_RenderCommandType, CLAY_PACKED_ENUM {
|
CLAY__TYPEDEF(Clay_RenderCommandType, CLAY_PACKED_ENUM {
|
||||||
CLAY_RENDER_COMMAND_TYPE_NONE,
|
CLAY_RENDER_COMMAND_TYPE_NONE,
|
||||||
CLAY_RENDER_COMMAND_TYPE_RECTANGLE,
|
CLAY_RENDER_COMMAND_TYPE_RECTANGLE,
|
||||||
@ -515,6 +522,7 @@ void Clay_BeginLayout(void);
|
|||||||
Clay_RenderCommandArray Clay_EndLayout(void);
|
Clay_RenderCommandArray Clay_EndLayout(void);
|
||||||
Clay_ElementId Clay_GetElementId(Clay_String idString);
|
Clay_ElementId Clay_GetElementId(Clay_String idString);
|
||||||
Clay_ElementId Clay_GetElementIdWithIndex(Clay_String idString, uint32_t index);
|
Clay_ElementId Clay_GetElementIdWithIndex(Clay_String idString, uint32_t index);
|
||||||
|
Clay_ElementData Clay_GetElementData (Clay_ElementId id);
|
||||||
bool Clay_Hovered(void);
|
bool Clay_Hovered(void);
|
||||||
void Clay_OnHover(void (*onHoverFunction)(Clay_ElementId elementId, Clay_PointerData pointerData, intptr_t userData), intptr_t userData);
|
void Clay_OnHover(void (*onHoverFunction)(Clay_ElementId elementId, Clay_PointerData pointerData, intptr_t userData), intptr_t userData);
|
||||||
bool Clay_PointerOver(Clay_ElementId elementId);
|
bool Clay_PointerOver(Clay_ElementId elementId);
|
||||||
@ -4005,6 +4013,19 @@ Clay_ScrollContainerData Clay_GetScrollContainerData(Clay_ElementId id) {
|
|||||||
return CLAY__INIT(Clay_ScrollContainerData) CLAY__DEFAULT_STRUCT;
|
return CLAY__INIT(Clay_ScrollContainerData) CLAY__DEFAULT_STRUCT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CLAY_WASM_EXPORT("Clay_GetElementData")
|
||||||
|
Clay_ElementData Clay_GetElementData(Clay_ElementId id){
|
||||||
|
Clay_LayoutElementHashMapItem * item = Clay__GetHashMapItem(id.id);
|
||||||
|
if(item == &CLAY__LAYOUT_ELEMENT_HASH_MAP_ITEM_DEFAULT) {
|
||||||
|
return CLAY__INIT(Clay_ElementData) CLAY__DEFAULT_STRUCT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CLAY__INIT(Clay_ElementData){
|
||||||
|
.boundingBox = item->boundingBox,
|
||||||
|
.found = true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
CLAY_WASM_EXPORT("Clay_SetDebugModeEnabled")
|
CLAY_WASM_EXPORT("Clay_SetDebugModeEnabled")
|
||||||
void Clay_SetDebugModeEnabled(bool enabled) {
|
void Clay_SetDebugModeEnabled(bool enabled) {
|
||||||
Clay_Context* context = Clay_GetCurrentContext();
|
Clay_Context* context = Clay_GetCurrentContext();
|
||||||
|
Loading…
Reference in New Issue
Block a user