doc
parent
7f6da59973
commit
44ffa5808c
|
@ -41,6 +41,13 @@
|
|||
|
||||
# 3. GUI的锚点Anchor
|
||||
|
||||
- 是一个点,锚点描述的是一个对象的Margin,相对于锚点的坐标
|
||||
- 锚点的left,top,right,bottom是相对于父节点的值
|
||||
- 主要是用于描述子节点相对于父节点的位置
|
||||
- 当对一个节点的子节点进行设置锚点时,子节点的锚点范围只能够是父节点的控件区域内。
|
||||
- 注意任何布局也都是相对于父窗口矩形的
|
||||
- **主要用于在GUI中描述子节点相对于父节点的位置**
|
||||
|
||||
![Image text](image/gui2.png)
|
||||
![Image text](image/gui3.png)
|
||||
![Image text](image/gui4.png)
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://icon.png" type="Texture" id=1]
|
||||
|
||||
[node name="Node2D" type="Node2D"]
|
||||
|
||||
[node name="icon" type="Sprite" parent="."]
|
||||
position = Vector2( 102.421, 70.9156 )
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="ButtonParent" type="Button" parent="."]
|
||||
margin_left = 323.666
|
||||
margin_top = 121.838
|
||||
margin_right = 376.666
|
||||
margin_bottom = 141.838
|
||||
text = "Parent"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Button" type="Button" parent="ButtonParent"]
|
||||
margin_right = 44.0
|
||||
margin_bottom = 20.0
|
||||
text = "Child"
|
Loading…
Reference in New Issue