EngineHub / SchematicWebViewer

An NPM package to facilitate importing and viewing of modern Minecraft schematics.
https://madelinemiller.dev/contact/
MIT License
64 stars 7 forks source link

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

Open Klee319 opened 11 months ago

Klee319 commented 11 months ago

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

me4502 commented 11 months ago

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.

Klee319 commented 11 months ago

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', });

neunapp commented 6 months ago

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.

Klee319 commented 6 months ago

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