Canvas#

Canvas

A canvas for user interface elements. See GET /ui/stock-canvas and POST /ui/add-canvas.

A Canvas object is passed and returned as its identifier, a number. A path that acts on an object takes it as (id).

GET /ui/canvas/(id)/rect-transform#

The rect transform for the UI object.

Parameters:
  • id – The identifier of the Canvas object.

Response JSON Object:
  • value (UI.RectTransform)

GET /ui/canvas/(id)/layout-element#

How much space the UI object asks a layout for.

Note

Only has an effect when the object is in a panel that has a layout. A canvas is not inside a layout and does not have one.

Parameters:
  • id – The identifier of the Canvas object.

Response JSON Object:
  • value (UI.LayoutElement)

GET /ui/canvas/(id)/visible#

Whether the UI object is visible.

Note

This is the object’s own setting, which is what it was last set to. An object is only drawn when everything it is inside is visible as well, so an interface can be built with its parts visible, inside a panel that is not, and shown all at once by making that panel visible.

Parameters:
  • id – The identifier of the Canvas object.

Response JSON Object:
  • value (bool)

PUT /ui/canvas/(id)/visible#

Whether the UI object is visible.

Note

This is the object’s own setting, which is what it was last set to. An object is only drawn when everything it is inside is visible as well, so an interface can be built with its parts visible, inside a panel that is not, and shown all at once by making that panel visible.

Parameters:
  • id – The identifier of the Canvas object.

Request JSON Object:
  • value (bool) – The new value.

POST /ui/canvas/(id)/add-panel#

Create a panel within this object.

Parameters:
  • id – The identifier of the Canvas object.

Request JSON Object:
  • visible (bool) – Whether the new panel is visible. Optional, defaults to true.

Response JSON Object:
  • value (UI.Panel)

POST /ui/canvas/(id)/add-text#

Add text to this object.

Parameters:
  • id – The identifier of the Canvas object.

Request JSON Object:
  • content (string) – The text.

  • visible (bool) – Whether the text is visible. Optional, defaults to true.

Response JSON Object:
  • value (UI.Text)

POST /ui/canvas/(id)/add-input-field#

Add an input field to this object.

Parameters:
  • id – The identifier of the Canvas object.

Request JSON Object:
  • visible (bool) – Whether the input field is visible. Optional, defaults to true.

Response JSON Object:
  • value (UI.InputField)

POST /ui/canvas/(id)/add-button#

Add a button to this object.

Parameters:
  • id – The identifier of the Canvas object.

Request JSON Object:
  • content (string) – The label for the button.

  • visible (bool) – Whether the button is visible. Optional, defaults to true.

Response JSON Object:
  • value (UI.Button)

POST /ui/canvas/(id)/add-toggle#

Add a toggle to this object.

Parameters:
  • id – The identifier of the Canvas object.

Request JSON Object:
  • content (string) – The label for the toggle.

  • visible (bool) – Whether the toggle is visible. Optional, defaults to true.

Response JSON Object:
  • value (UI.Toggle)

POST /ui/canvas/(id)/add-toggle-group#

Add a toggle group to this object, to make a set of toggles into radio buttons.

Note

The group is not drawn and does not take up any space. The toggles that belong to it can be added anywhere.

Parameters:
  • id – The identifier of the Canvas object.

Response JSON Object:
  • value (UI.ToggleGroup)

POST /ui/canvas/(id)/add-slider#

Add a slider to this object.

Parameters:
  • id – The identifier of the Canvas object.

Request JSON Object:
  • vertical (bool) – Whether the slider runs from bottom to top, rather than from left to right. Optional, defaults to false.

  • visible (bool) – Whether the slider is visible. Optional, defaults to true.

Response JSON Object:
  • value (UI.Slider)

POST /ui/canvas/(id)/add-dropdown#

Add a dropdown to this object.

Parameters:
  • id – The identifier of the Canvas object.

Request JSON Object:
  • visible (bool) – Whether the dropdown is visible. Optional, defaults to true.

Response JSON Object:
  • value (UI.Dropdown)

POST /ui/canvas/(id)/add-image#

Add an image to this object.

Parameters:
  • id – The identifier of the Canvas object.

Request JSON Object:
  • visible (bool) – Whether the image is visible. Optional, defaults to true.

Response JSON Object:
  • value (UI.Image)

POST /ui/canvas/(id)/add-scroll-view#

Add a scroll view to this object.

Parameters:
  • id – The identifier of the Canvas object.

Request JSON Object:
  • visible (bool) – Whether the scroll view is visible. Optional, defaults to true.

Response JSON Object:
  • value (UI.ScrollView)

POST /ui/canvas/(id)/remove#

Remove the UI object.

Parameters:
  • id – The identifier of the Canvas object.