SchematicWebViewer icon indicating copy to clipboard operation
SchematicWebViewer copied to clipboard

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'trackUbosInFrame')

Open Klee319 opened this issue 2 years ago • 4 comments

I am very interested in this library. While other web viewers had outdated support versions, this one seemed to support even the latest versions (as the commits are recent). However, I am facing the following error and am in trouble.

image

Klee319 avatar Nov 14 '23 15:11 Klee319

You're going to need to provide significantly more information than this. The version you're using, the schematic file, how you're building the site, the code you're using, etc

Ideally a minimal reproduction. As-is there's nothing that can be done based on your report.

me4502 avatar Nov 14 '23 23:11 me4502

OK. Thank you for your reply. This is my environment of development Base language: Ruby 3.1.2 Framework: rails 7.0.5 ViwerVersion:4.8.1 minecraft jar file:1.20.2 I use webpack.

html.erb <javascript_pack_tag "SchematicViwer"> <canvas id="schematicRenderer" , width="500," height="500"></canvas> SchematicViwer.js import {renderSchematic} from "@enginehub/schematicwebviwer" renderSchematic(document.querySelector('#schematicRenderer'), "./sample.schem", { size: 500, renderArrow: false, renderBars: false, corsBypassUrl: 'client.jar', });

Klee319 avatar Nov 14 '23 23:11 Klee319

Hello, I had this error, I solved it. This error happens because the html block where it is going to be drawn has not yet been loaded, but the scene is waiting to be created. What I did was isolate everything into a function that will create the scene after all the html is loaded.

neunapp avatar Apr 05 '24 20:04 neunapp

@neunapp Thank you for your comment! I'll try it right away!

Klee319 avatar Apr 06 '24 00:04 Klee319