LS.GUI Class
GUI is a static class used to attach HTML elements on top of the 3D Canvas in a safe way
Constructor
LS.GUI
()
Methods
attach
-
element
-
anchor
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
Creates a HTMLElement of the tag_type and adds it to the DOM on top of the canvas
Parameters:
-
tag_type
Stringthe tag type "div"
-
anchor
String"top-left", "top-right", "bottom-left", "bottom-right" or "none"
Returns:
detach
-
element
Removes an element from the GUI (same as element.parentNode.removeChild( element ); )
Parameters:
-
element
HTMLElementHTML element to detach from the GUI
getRoot
()
HTMLElement
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:
hide
()
hides the GUI (but it is still existing)
load
-
url
-
on_complete
Loads resource containing the HTML code for the GUI and attachs it inside a div to the hud
Parameters:
-
url
Stringthe url of the resource containing all the HTML code
-
on_complete
Functioncallback that will be called once the HTML has been loaded and attached to the doom, it receives the HTMLElement containing all the HTML
reset
()
Removes all the GUI elements from the DOM
show
()
shows the GUI