Sign in to follow this  

Can GUI work in Angular 6 project?

Recommended Posts

Hi guys,

I got a problem when using GUI in Angular 6 project. Hope someone can give me a hand.
The engine and scene are created in ngAfterContentInit() function as below. 


  let canvas = this.el.nativeElement;
  let engine = new BABYLON.Engine(canvas, true);
  let scene = new BABYLON.Scene(engine);
  let camera = new BABYLON.ArcRotateCamera('camera', 1, 1, 10, BABYLON.Vector3.Zero(), scene);

  let advancedTexture = GUI.AdvancedDynamicTexture.CreateFullscreenUI("UI");

  let text1 = new GUI.TextBlock();
  text1.text = "Hello world";
  text1.color = "white";
  text1.fontSize = 24;
  text1.shadowColor = "black";
  text1.shadowOffsetX = 2;
  text1.shadowOffsetY = 2;

  let box:BABYLON.Mesh = BABYLON.Mesh.CreateBox('box', 1, scene);


The scene works well, "Hello word" shows on the screen. But when moving mouse on the screen, keeping get below error:
ERROR TypeError: i.isPointerCaptured is not a function
    at e.callback (babylon.gui.min.js:1)
    at r.push../node_modules/babylonjs/babylon.js.r.notifyObservers (babylon.js:3)
    at HTMLCanvasElement._onPointerMove (babylon.js:12)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
    at Object.onInvokeTask (core.js:4062)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
    at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:496)
    at invokeTask (zone.js:1540)
    at HTMLCanvasElement.globalZoneAwareCallback (zone.js:1566)
This problem CAN'T be reproduced in PG.

Share this post

Link to post
Share on other sites
On 5/15/2018 at 11:30 PM, Deltakosh said:

Rats! I need to see it live to help. Can you publish your project to a live server? (it could be cool to reference non minified version of bjs and GUi so I can debug :))

Hi Deltakosh. Just checked in GUI 3.3.0-alpha.2, The problem is gone. Thanks!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.