You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -225,7 +225,7 @@ Clay elements can optionally be tagged with a unique identifier using [CLAY_ID()
225
225
CLAY(CLAY_ID("OuterContainer"), style) {}
226
226
```
227
227
228
-
Element IDs have two main use cases. Firstly, tagging an element with an ID allows you to query information about the element later, such as its [mouseover state](#clay-pointerover) or dimensions.
228
+
Element IDs have two main use cases. Firstly, tagging an element with an ID allows you to query information about the element later, such as its [mouseover state](#clay_pointerover) or dimensions.
229
229
230
230
Secondly, IDs are visually useful when attempting to read and modify UI code, as well as when using the built-in [debug tools](#debug-tools).
The function `void Clay_OnHover()` allows you to attach a function pointer to the currently open element, which will be called if the mouse / pointer is over the element.
// Pointer state allows you to detect mouse down / hold / release
266
-
if (pointerInfo.state == CLAY_POINTER_INFO_PRESSED_THIS_FRAME) {
266
+
if (pointerInfo.state == CLAY_POINTER_DATA_PRESSED_THIS_FRAME) {
267
267
// Do some click handling
268
268
NavigateTo(buttonData->link);
269
269
}
@@ -516,7 +516,7 @@ Prepares clay to calculate a new layout. Called each frame / layout **before** a
516
516
517
517
`Clay_RenderCommandArray Clay_EndLayout()`
518
518
519
-
Ends declaration of element macros and calculates the results of the currrent layout. Renders a [Clay_RenderCommandArray](#clay_rendercommandarrray) containing the results of the layout calculation.
519
+
Ends declaration of element macros and calculates the results of the current layout. Renders a [Clay_RenderCommandArray](#clay_rendercommandarray) containing the results of the layout calculation.
520
520
521
521
### Clay_Hovered
522
522
@@ -526,15 +526,15 @@ Called **during** layout declaration, and returns `true` if the pointer position
Called **during** layout declaration, this function allows you to attach a function pointer to the currently open element that will be called once per layout if the pointer position previously set with `Clay_SetPointerState` is inside the bounding box of the currently open element. See [Clay_PointerInfo](#clay-pointer-info) for more information on the `pointerInfo` argument.
531
+
Called **during** layout declaration, this function allows you to attach a function pointer to the currently open element that will be called once per layout if the pointer position previously set with `Clay_SetPointerState` is inside the bounding box of the currently open element. See [Clay_PointerData](#clay_pointerdata) for more information on the `pointerData` argument.
Returns a [Clay_ElementId](#clay-elementid) for the provided id string, used for querying element info such as mouseover state, scroll container data, etc.
567
+
Returns a [Clay_ElementId](#clay_elementid) for the provided id string, used for querying element info such as mouseover state, scroll container data, etc.
**RECTANGLE** configures a clay element to background-fill its bounding box with a color. It uses [Clay_RectangleElementConfig](#clay_rectangleelementconfig) for rectangle specific options.
765
+
**RECTANGLE** configures a clay element to background-fill its bounding box with a color. It uses `Clay_RectangleElementConfig` for rectangle specific options.
766
766
767
767
**Struct API (Pseudocode)**
768
768
@@ -1061,7 +1061,7 @@ Element is subject to [culling](#visibility-culling). Otherwise, a single `Clay_
1061
1061
1062
1062
**Notes**
1063
1063
1064
-
**SCROLL** configures the element as a scrolling container, enabling masking of children that extend beyond its boundaries. It uses [Clay_ScrollElementConfig](#clay_scrollelementconfig) to configure scroll specific options.
1064
+
**SCROLL** configures the element as a scrolling container, enabling masking of children that extend beyond its boundaries. It uses `Clay_ScrollElementConfig` to configure scroll specific options.
1065
1065
1066
1066
Note: In order to process scrolling based on pointer position and mouse wheel or touch interactions, you must call `Clay_SetPointerState()` and `Clay_UpdateScrollContainers()` _before_ calling `BeginLayout`.
1067
1067
@@ -1241,7 +1241,7 @@ Rendering of borders and rounded corners is left up to the user. See the provide
1241
1241
1242
1242
Floating containers:
1243
1243
1244
-
- With the [default configuration](#clay_floating_config), attach to the top left corner of their "parent"
1244
+
- With the default configuration, attach to the top left corner of their "parent"
1245
1245
- Don't affect the width and height of their parent
1246
1246
- Don't affect the positioning of sibling elements
1247
1247
- Depending on their z-index can appear above or below other elements, partially or completely occluding them
@@ -1438,7 +1438,7 @@ When using `.parentId`, the floating container can be declared anywhere after `B
1438
1438
1439
1439
**Notes**
1440
1440
1441
-
**CUSTOM_ELEMENT** uses [Clay_LayoutConfig](#clay_layout) for styling and layout, and allows the user to pass custom data to the renderer.
1441
+
**CUSTOM_ELEMENT** allows the user to pass custom data to the renderer.
Element is subject to [culling](#visibility-culling). Otherwise, a single `Clay_RenderCommand` with `commandType = CLAY_RENDER_COMMAND_TYPE_CUSTOM` will be created.
1525
-
The user will need to access [Clay_CustomElementConfig](#clay_custom_element_config) to retrieve custom data referenced during layout creation.
1526
1525
1527
1526
## Data Structures & Definitions
1528
1527
@@ -1709,4 +1708,46 @@ Dimensions representing the inner width and height of the content _inside_ the s
1709
1708
1710
1709
**`.config`** - `Clay_ScrollElementConfig`
1711
1710
1712
-
The [Clay_ScrollElementConfig](#clay_scroll_config) for the matching scroll container element.
1711
+
The [Clay_ScrollElementConfig](#clay_scroll) for the matching scroll container element.
1712
+
1713
+
### Clay_PointerData
1714
+
1715
+
```C
1716
+
typedefstruct
1717
+
{
1718
+
Clay_Vector2 position;
1719
+
Clay_PointerDataInteractionState state;
1720
+
} Clay_PointerData;
1721
+
```
1722
+
1723
+
**Fields**
1724
+
1725
+
**`.position`** - `Clay_Vector2`
1726
+
1727
+
A Vector2 containing the current x,y coordinates of the mouse pointer, which were originally passed into [Clay_SetPointerState()](#clay_setpointerstate).
1728
+
1729
+
---
1730
+
1731
+
**`.state`** - `Clay_PointerDataInteractionState`
1732
+
1733
+
```C
1734
+
typedefenum
1735
+
{
1736
+
CLAY_POINTER_DATA_PRESSED_THIS_FRAME,
1737
+
CLAY_POINTER_DATA_PRESSED,
1738
+
CLAY_POINTER_DATA_RELEASED_THIS_FRAME,
1739
+
CLAY_POINTER_DATA_RELEASED,
1740
+
} Clay_PointerDataInteractionState;
1741
+
```
1742
+
1743
+
An enum value representing the current "state" of the pointer interaction. As an example, consider the case where a user is on a desktop computer, moves the mouse pointer over a button, clicks and holds the left mouse button for a short time, then releases it:
1744
+
1745
+
- While the mouse pointer is over ("hovering") the button, but no mouse button has been pressed: `CLAY_POINTER_DATA_RELEASED`
1746
+
- First frame that the user presses the left mouse button: `CLAY_POINTER_DATA_PRESSED_THIS_FRAME`
1747
+
- All subsequent frames where the user is still holding the left mouse button: `CLAY_POINTER_DATA_PRESSED`
1748
+
- The single frame where the left mouse button goes from pressed -> released: `CLAY_POINTER_DATA_RELEASED_THIS_FRAME`
1749
+
- All subsequent frames while the mouse pointer is still over the button: `CLAY_POINTER_DATA_RELEASED`
if (Clay__pointerInfo.position.x>Clay__layoutDimensions.width- (float)Clay__debugViewWidth&&Clay__pointerInfo.position.x<Clay__layoutDimensions.width&&Clay__pointerInfo.position.y>0&&Clay__pointerInfo.position.y<Clay__layoutDimensions.height) {
2878
2878
for (inti= (int)Clay__pointerOverIds.length-1; i >= 0; i--) {
0 commit comments