Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
create(scene: Scene): BabylonButton3D {
this.button3D = new BabylonButton3D(this.props.name)
// console.log("created button", this.props.name)
let text: TextBlock | undefined = undefined
let image: BabylonImage | undefined = undefined
if (this.props.imageUrl) {
image = new BabylonImage(`${this.props.name}-image`, this.props.imageUrl)
}
if (this.props.text) {
text = new TextBlock()
text.text = this.props.text
if (this.props.fontColor) {
text.color = this.props.fontColor.toHexString()
} else {
text.color = "white" // default in BabylonJS
}
if (this.props.fontSize) {
text.fontSize = this.props.fontSize
} else {
text.fontSize = 24 // default in BabylonJS