API Docs for:
Show:

LS.GUI Class

Defined in: ../src/gui.js:2
Module: LS

GUI is a static class used to attach HTML elements on top of the 3D Canvas in a safe way

Constructor

LS.GUI

()

Defined in ../src/gui.js:2

Methods

attach

(
  • element
  • anchor
)

Defined in ../src/gui.js:79

attach HTMLElement to GUI Root in the anchor position specified

Parameters:

  • element HTMLElement
  • anchor String

    "top-left", "top-right", "bottom-left", "bottom-right" or "none"

createElement

(
  • tag_type
  • anchor
)
HTMLElement

Defined in ../src/gui.js:62

Creates a HTMLElement of the tag_type and adds it to the DOM on top of the canvas

Parameters:

  • tag_type String

    the tag type "div"

  • anchor String

    "top-left", "top-right", "bottom-left", "bottom-right" or "none"

Returns:

HTMLElement:

detach

(
  • element
)

Defined in ../src/gui.js:140

Removes an element from the GUI (same as element.parentNode.removeChild( element ); )

Parameters:

  • element HTMLElement

    HTML element to detach from the GUI

getRoot

() HTMLElement

Defined in ../src/gui.js:13

Returns the DOM element responsible for the GUI of the app. This is helpful because this GUI will be automatically removed if the app finishes.

Returns:

HTMLElement:

hide

()

Defined in ../src/gui.js:187

hides the GUI (but it is still existing)

load

(
  • url
  • on_complete
)

Defined in ../src/gui.js:199

Loads resource containing the HTML code for the GUI and attachs it inside a div to the hud

Parameters:

  • url String

    the url of the resource containing all the HTML code

  • on_complete Function

    callback that will be called once the HTML has been loaded and attached to the doom, it receives the HTMLElement containing all the HTML

reset

()

Defined in ../src/gui.js:152

Removes all the GUI elements from the DOM

show

()

Defined in ../src/gui.js:174

shows the GUI