• Content Count

  • Joined

  • Last visited

About unintellisense

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi, I had a couple questions about the ScrollViewer GUI component. Is it possible from code to set the vertical or horizontal bar value, say based on some event (in my case, new text being added to a TextBlock inside the ScrollViewer)? For example, I may want to set the vertical scrollbar to the bottom when new text is appended to the end. I notice that if a scrollViewer is set to the bottom of content that is larger than the scrollViewer, if new content is added, it doesn't seem to update properly. A playground probably demos this best: https://www.babylonjs-playground.com/#3EF49E#11 After loading the scene, scroll the ScrollViewer to the bottom before 5 seconds is up and the setTimeout events start firing to update the TextBlock inside the scrollviewer. Until you manually scroll up and down again, the new content isn't shown. I was able to solve the first item in my own fork of the ScrollViewer, but for the second, I had issues unless I used delayed events (via setTImeout) to alter the scrollbar values, which I suspect was because without the delay the new size of the TextBlock wasn't calculated or something to that effect. using textBlock.onTextChangedObservable still seemed to be too early (I tried other variations which I don't recall now). Thanks as always for this wonderful engine!
  2. Oh, that works I had just created a more specific onEnterKeyObservable but that works too. Awesome, thanks again!
  3. Thanks for the response, I see what you mean. I will go ahead and do something like that for now. But, what do you think about a onEnterKeyObservable being added to InputText? I can submit a PR as it seems like it would be a pretty minor change (hardest part is knowing which of the generated files to actually add to my branch for the PR after building, looks like lots of totally unrelated files show diffs)?
  4. Hello, I am using the GUI InputText, and would like to be able to react to the enter key being pressed. I see there is onBlurObservable, but unless I'm wrong I can't tell from the event whether it lost focus from the enter key or clicking away? The use case I am trying to handle is a chatbox, where the enter key would invoke a function to handle the current contents of the InputText before clearing it. Thanks for reading!
  5. What I don't understand is why when I pull babylon.js master and build (without making any changes to ts files), the /dist files generated already shows diffs. It looks like it is just placing things into a different order, but do not understand why? I cleaned node_modules from tools/gulp to be on the safe side, but same results. Anyway, here is the PR, thanks https://github.com/BabylonJS/Babylon.js/pull/2661
  6. Hello! I am not using ActionManagers or anything like that in a particular scene, but I would like to change the default cursor for my scenes to something else. I found that babylon will set style.cursor back to "" if it doesn't detect a mesh to use the hoverCursor property for. I changed my fork to instead refer to a defaultCursor property in babylon.scene.ts which defaults to the same empty string that is being used in the _onPointerMove function when it doesn't determine it should set the hoverCursor property for. Is that something that might be interesting to merge in? If so, I'll make a pull request. Thanks for a awesome library as always.
  7. http://www.babylonjs-playground.com/#3QUZ2P In my own project I recently started using BABYLON.Spotlights mounted to some other meshes which move around, and I noticed some strange artifact/ray that reflects on all surfaces, seemingly towards 0, 0, 0. ( look at bottom of the view in PG). I only see it start happening when I parent a FreeCamera (maybe any camera, dunno) to a mesh. same PG without the parenting > http://www.babylonjs-playground.com/#3QUZ2P#1 Is this something I am doing wrong?
  8. I don't know of a Visual Studio specific solution, nor a solution specific to any IDE for that matter. I have accomplished this using build/bundling process, gulp/browserify with the tsify, envify and uglify plugins. This is how I implemented it, hopefully it makes sense as I am just copy/pasting and not trimming it down to the bare example. gulp.task('browser:watch:min', ['browser:clean', 'browser:static:min'], () => { let bundler = browserify(path.join(__dirname, 'src', 'browserMain.ts'), { paths: ['./src'] }) .plugin(tsify, tsconfig.compilerOptions) .transform(browserifyCss) .transform(envify, { BUILD_FLAG: 'production', BUILD_MODE: 'browser' }) .plugin(watchify); bundler.on('update', () => { loadBundle(bundler, true) }); loadBundle(bundler, true); }); gulp.task('browser:watch:max', ['browser:clean', 'browser:static:max'], () => { let bundler = browserify(path.join(__dirname, 'src', 'browserMain.ts'), { paths: ['./src'] }) .plugin(tsify, tsconfig.compilerOptions) .transform(browserifyCss) .transform(envify, { BUILD_FLAG: 'development', BUILD_MODE: 'browser' }) .plugin(watchify); bundler.on('update', () => { loadBundle(bundler, false) }); loadBundle(bundler, false); }); function loadBundle(bundler, makeUgly) { let now = new Date(); console.log(` ${(now.getHours() < 10 ? '0' : '') + now.getHours()}:${(now.getMinutes() < 10 ? '0' : '') + now.getMinutes()}:${(now.getSeconds() < 10 ? '0' : '') + now.getSeconds()} reloading bundle...`); let newBundle = bundler.bundle().on('error', (error) => console.error(error.toString())) .pipe(source('bundle.js')); if (makeUgly) { newBundle.pipe(streamify(uglify())); } newBundle.pipe(gulp.dest(__dirname + '/build')) .on('end', function () { let now = new Date(); console.log(` ${(now.getHours() < 10 ? '0' : '') + now.getHours()}:${(now.getMinutes() < 10 ? '0' : '') + now.getMinutes()}:${(now.getSeconds() < 10 ? '0' : '') + now.getSeconds()} bundle reloaded...`); }); } 'browser:watch:min' and 'browser:watch:max' are the gulp tasks which will pass a different argument to envify, the BUILD_FLAG property in particular being used later. I do the same thing on the server side but just using gulp-envify and gulp-uglify. Then in a ts file, you can refer to BUILD_FLAG, which when compiled gets converted by envidy to the literal value passed in the gulp task. if ("development" === process.env.BUILD_FLAG) { console.log(`attachControl: TopDownFocusCameraMouseInput`) } When compiled (with browser:watch:min task in this example) becomes if ("development" === "production") { console.log(`attachControl: TopDownFocusCameraMouseInput`) } Finally, uglifys dead code removal would completely remove this from the emitted js file. Depending on your build setup you may be able to accomplish this with less pieces. There is a webpack loader https://github.com/nippur72/ifdef-loader that lets you use something closer to compiler directives, but I don't use webpack and don't really like the approach, for some reason the directives being in comments (that would be ignored if the ts gets built differently, I.E. without webpack) rubs me the wrong way. Hope this helps. I am also curious to see what solutions others might use.
  9. Very cool. I have experimented with using Angular and Babylonjs before. One thing I ran into before I understood what was happening was ngZone causing horrible performance due to the way it monkey patches all asynchronous calls (including requestAnimationFrame) for its change detection. I found I had to disable change detection for these calls like so: this.zone.runOutsideAngular(() => { this.engine.runRenderLoop(() => { this.scene.render(); }); })
  10. Looks like it gets exacerbated when a high width/height are passed to createForMesh. http://www.babylonjs-playground.com/#ZI9AK7#14
  11. Here is a PG to demonstrate the issue: http://www.babylonjs-playground.com/#ZI9AK7#13 If you click above the actual button you'll see events getting registered, but they certainly are not lining up with the actual button position. Seems like it happens anytime the width or height are set, even if its the direct descendant of the AdvancedDynamicTexture. This used to work, only noticed it on my project when I refreshed from preview the other day.
  12. Hi, I notice that when using texture mode and a button, the default scaling animation is not reversed if the mouse is not released over the button: http://www.babylonjs-playground.com/#ZI9AK7#7 Try clicking down on the button and moving the cursor before releasing. In my own project it behaves a bit differently, I actually have to release it over something over than the canvas to reproduce. Thanks for the great library in general and BABYLON.GUI in particular lately
  13. This is a very minor issue, but it also has a very minor fix I think. When building a TS project which includes the latest preview babylon.js typings, with the strictNullCheck:true flag set, the following error happens during compilation: lib/babylon.d.ts(674,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'crossOrigin' must be of type 'string | null', but here has type 'string'. The Typescript provided lib.d.ts defines crossOrigin as 'string | null' as the error suggests. Admittedly I am not sure of the build process used for BJS, But I think that this line https://github.com/BabylonJS/Babylon.js/blob/92ab030b50fc277904a823be642755d3f0fef006/src/babylon.mixins.ts#L155 just needs to be changed to match the lib.d.ts shape ( string | null ). I've never contributed to this project, but can create a PR if you want.