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.

SubViewportContainer

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

用於顯示 SubViewport 內容的容器。

說明

顯示其 SubViewport 子節點內容的容器。除非啟用 stretch,否則會使用 SubViewport 的大小作為最小尺寸。

注意:更改 SubViewportContainerControl.scale,將導致其內容出現扭曲。要更改其視覺大小,並且不造成失真,請改為調整節點的邊距(如果還不在容器中)。

注意:SubViewportContainer 會將滑鼠進入和滑鼠退出通知轉發到子視口。

屬性

FocusMode

focus_mode

1 (overrides Control)

bool

mouse_target

false

bool

stretch

false

int

stretch_shrink

1

方法

bool

_propagate_input_event(event: InputEvent) virtual const


屬性說明

bool mouse_target = false 🔗

  • void set_mouse_target(value: bool)

  • bool is_mouse_target_enabled()

Configure, if either the SubViewportContainer or alternatively the Control nodes of its SubViewport children should be available as targets of mouse-related functionalities, like identifying the drop target in drag-and-drop operations or cursor shape of hovered Control node.

If false, the Control nodes inside its SubViewport children are considered as targets.

If true, the SubViewportContainer itself will be considered as a target.


bool stretch = false 🔗

  • void set_stretch(value: bool)

  • bool is_stretch_enabled()

如果為 true,子視口將自動調整為該控制項的大小。

注意:如果為 true,則會禁止手動改變其子節點的 SubViewport.size


int stretch_shrink = 1 🔗

  • void set_stretch_shrink(value: int)

  • int get_stretch_shrink()

將子視口的有效解析度除以該值,同時保持比例。可以用來加速算繪。

例如子視口的大小為 1280×720,當 stretch_shrink 被設定為 2 時,將以 640×360 算繪,同時在該容器中佔據相同大小。

注意:stretch 必須為 true,才能使此屬性生效。


方法說明

bool _propagate_input_event(event: InputEvent) virtual const 🔗

實驗性: 此方法可能在未來版本中變更或移除。

Virtual method to be implemented by the user. If it returns true, the event is propagated to SubViewport children. Propagation doesn't happen if it returns false. If the function is not implemented, all events are propagated to SubViewports.