Basic GUI: simple example
Show hide a basic GUI on clickâ
Use the basicGUI api to show a GUI onclick
Processâ
- Place a button for the sake of this example
- Place the following script on the feature:
// Create GUI
let gui = feature.createBasicGui()
feature.on('click',e=>{
if(gui.showing){
// if GUI is showing, hide it. (act like a toggle)
gui.destroy()
return
}
// Add our first control:
gui.addText('Hello!')
// Call the GUI to show.
gui.show()
})
- if you want this to happen on a trigger instead of click, replace 'click' with 'trigger'
What happensâ
The scripts listens for a click and toggles a graphic interface on/off when clicked on.