How to use the babylonjs-gui.Control.HORIZONTAL_ALIGNMENT_CENTER function in babylonjs-gui

To help you get started, we’ve selected a few babylonjs-gui examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github brianzinn / react-babylonjs / src / Button3D.ts View on Github external
image.height = "180px"
      }
      image.paddingBottom = "10px"

      stackPanel.addControl(image)

      text.height = "56px" // was 30px in Holographic button, but wanted bigger text.

      stackPanel.addControl(text)
      this.button3D.content = stackPanel
    } else if (text) {
      this.button3D.content = text
    } else if (image) {
      // Scale the image to fill the container but maintain aspect ratio. Default is STRETCH_FILL
      image.stretch = BabylonImage.STRETCH_UNIFORM
      image.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER
      this.button3D.contentScaleRatio = 1
      this.button3D.content = image
    }

    if (this.props.onClick) {
      // onPointerClickObservable has some issues...
      this.button3D.onPointerDownObservable.add(() => {
        this.props.onClick(this.button3D!)
      })
    }

    return this.button3D
  }