cocos_anchor_to_edge
Anchor UI elements to parent edges or corners with customizable margins using Cocos Creator's Widget component for precise layout positioning.
Instructions
Pin node to an edge / corner of its parent via cc.Widget.
edge: top / bottom / left / right /
top-left / top-right / bottom-left / bottom-right.
margin: distance from the edge (from both edges for corners).
Returns the Widget component id.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"scene_path": "<scene_path>",
"node_id": "<node_id>",
"edge": "<edge>"
},
"name": "cocos_anchor_to_edge"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scene_path | Yes | ||
| node_id | Yes | ||
| edge | Yes | ||
| margin | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |