Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedding BrainBrowser in a Vue.js project #353

Open
Aharonyn opened this issue Feb 27, 2020 · 0 comments
Open

Embedding BrainBrowser in a Vue.js project #353

Aharonyn opened this issue Feb 27, 2020 · 0 comments

Comments

@Aharonyn
Copy link

Hi,

I have been trying to adjust my project to work with BrainBrowser (SurfaceViewer in particular) but unfortunately I can't seem to grasp the way it should work.
The closest I got was to use "require" on each .js file relevant to the SurfaceViewer (according to the demo), and then using the start method (according to instructions in the documentation). I fixed one problem: when getting the dom_element, document couldn't find the canvas div id, because it is nested inside the 'app' div of Vue. I used jQuery in order to fix this:
($('#app').find('#' + element)[0])
The problem now, is that I get this error: SyntaxError: expected expression, got '<'.
Apparently, this error is caused by the fact that a javascript file is expected, but the file supplied was html. Here is the code that invokes the error:

BrainBrowser.SurfaceViewer.start('mainBrowser', function(viewer) {
      //Add an event listener.
      viewer.addEventListener('displaymodel', function() {
        console.log('We have a model!')
      })
      // Start rendering the scene.
      viewer.render()
      // Load a model into the scene.
      viewer.loadModelFromURL('/brain-surface.obj')
    })

Does anyone have any experience with embedding this library in Vue, or have any idea how to solve this problem?

Thanks,
Noam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant