Speckle Viewer correct source / documentation

Hi,

I’m trying to work with the speckle viewer and am wondering if I am using the correct version/documentation.

I am currently on the latest version of the speckle viewer from npm (2.9.0).
The referenced documentation is here, although I assume that it might be outdated since the viewer is still changing. So far I have assumed that the source code for the viewer is the one found here on github but I can’t seem to get the code from github to mach my locally installed files. ( missing functions, types, etc.)

Is the best way to clone the whole speckle-server repository and just reference the files form there?
Is the speckle viewer on npm actually tracking different source code?

I don’t need a fully flushed out documentation. I am happy reading source code.
But I have the impression that right now I am trying to reverse engineer the node module.

PS: Might it be an idea to make the individual packages in the speckle-server repository their own submodules?
That way one could clone them individually but still work on them as a whole inside the speckle-server project.

1 Like

To headline out some of the things we discussed earlier, I have some good news:

  • The 2.9.0 npm package release is the same as within the speckle-server viewer package. Including all the typing you are hoping for.
  • The API documentation is at parity with the code release. As-in there is nothing there that is no longer within the API

The bad news is that wasn’t your experience.

If you take a look at the minimal solution package sandbox-viewer perhaps isolated from your current code changing the dependency for viewer from

  "dependencies": {
    "@speckle/viewer": "workspace:^",
    ...
  },

to

  "dependencies": {
    "@speckle/viewer": "^2.9.0",
    ...
  },

install and run from there.

Compare with how your currently integrated code compares with that in main.ts

The specifics of handling click event example in the API documentation works with both a viewer referencing the server code or the npm release

viewer.on(ViewerEvent.ObjectClicked, (selectionInfo: SelectionEvent) => {
  if (selectionInfo) {
		// Object was clicked. Focus in on it
    viewer.zoom([selectionInfo.userData.id as string])
  }
	else {
		// No object clicked. Restore focus to entire scene
		viewer.zoom()	
	}
})

indeed all the events are to be populated at runtime: Busy, LoadComplete, LoadProgress, ObjectClicked, ObjectDoubleClicked, SectionBoxChanged, UnloadAllComplete, UnloadComplete

Give that a go and if you have any further problems report back!

1 Like

Hi @jonathon,

thanks for the chat the other day and all the help.
I did some updating, rebuilding and copying of code snippets form the sandbox and it seems to be working. Actually, so well that now I am having trouble to reproduce the error from before.
I’ll have to do some cleaning up of my code as it is all over the place from all the edits. But I seem to be on a good track.

3 Likes