Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

GraphElement

繼承: Container < Control < CanvasItem < Node < Object

被繼承: GraphFrame, GraphNode

帶有連接埠的容器,代表 GraphEdit 中的一個節點。

說明

GraphElement 允許為 GraphEdit 圖表建立自訂元素。預設情況下,可以選擇此類元素、調整大小和重新定位,但無法連接它們。對於允許連接,請參閱GraphNode

屬性

bool

draggable

true

Vector2

position_offset

Vector2(0, 0)

bool

resizable

false

bool

scaling_menus

false

bool

selectable

true

bool

selected

false

主題屬性

Texture2D

resizer


訊號

delete_request() 🔗

需要對子節點進行排序時發出。


dragged(from: Vector2, to: Vector2) 🔗

當 GraphNode 被拖動時發出。


node_deselected() 🔗

當 GraphNode 被取消選擇時發出。


node_selected() 🔗

當 GraphNode 被選中時發出。


position_offset_changed() 🔗

當 GraphNode 被移動時觸發。


raise_request() 🔗

當 GraphNode 被要求顯示在其他節點之上時觸發。在 GraphNode 獲得焦點時觸發,即滑鼠點擊進入。


resize_end(new_size: Vector2) 🔗

Emitted when releasing the mouse button after dragging the resizer handle (see resizable).


resize_request(new_size: Vector2) 🔗

當 GraphNode 被要求調整大小時發出。在拖動調整器手柄時發生(見 resizable)。


屬性說明

bool draggable = true 🔗

  • void set_draggable(value: bool)

  • bool is_draggable()

如果為 true,則使用者能夠拖動該 GraphNode。


Vector2 position_offset = Vector2(0, 0) 🔗

  • void set_position_offset(value: Vector2)

  • Vector2 get_position_offset()

GraphNode 的偏移量,相對於 GraphEdit 的滾動偏移量。

注意:不能直接使用位置偏移,因為 GraphEdit 是一個 Container


bool resizable = false 🔗

  • void set_resizable(value: bool)

  • bool is_resizable()

If true, the user can resize the GraphElement.

Note: Dragging the handle will only emit the resize_request and resize_end signals, the GraphElement needs to be resized manually.


bool scaling_menus = false 🔗

  • void set_scaling_menus(value: bool)

  • bool is_scaling_menus()

If true, PopupMenus that are descendants of the GraphElement are scaled with the GraphEdit zoom.


bool selectable = true 🔗

  • void set_selectable(value: bool)

  • bool is_selectable()

如果為 true,則使用者能夠選中該 GraphNode。


bool selected = false 🔗

  • void set_selected(value: bool)

  • bool is_selected()

如果為 true,則該 GraphNode 被選中。


主題屬性說明

Texture2D resizer 🔗

用於調整大小的圖示,在 resizable 被啟用時可見。