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

Add callback for when all loading starts and ends #389

Closed
gkjohnson opened this issue Jul 4, 2023 · 4 comments · Fixed by #602
Closed

Add callback for when all loading starts and ends #389

gkjohnson opened this issue Jul 4, 2023 · 4 comments · Fixed by #602
Milestone

Comments

@gkjohnson
Copy link
Contributor

Related to #378

Such as tiles.onLoadStart and tiles.onLoadComplete.

This can already be implicitly done by checking the download and parse queue on every frame or in the onLoadModel callback (only can detect on end).

@arthurschiller
Copy link

Hi Garret, thanks for this great library! Could you give a brief example on how this would be accomplished via onLoadModel? How do I know the total amount of models that are going to be loaded so I can compare it with the current count? Sorry in case this is actually obvious. I just hit my quota rate limit on the google tiles API but wanted to give it a go tomorrow.

@gkjohnson
Copy link
Contributor Author

You can check the amount of models currently in the queue to be parsed or downloaded using downloadQueue.items.size and parseQueue.items.size. onLoadModel is called every time a model has been downloaded and parsed so when those fields are both set to 0 you know it's complete.

What's your use case exactly? If you have a compelling one and would like to open a PR to make this more convenient I can point you in the right direction.

@arthurschiller
Copy link

Thank you, that works! :)
My use case is similar to here: #378
I'm building a location based 3D editor and so I'm fetching tiles at a specified location via an Orthographic Camera.

I could certainly try, but I come from iOS development and am not too familiar with typescript.

@gkjohnson
Copy link
Contributor Author

I could certainly try, but I come from iOS development and am not too familiar with typescript.

The project is in Javascript if that changes anything. Either way up to you - also nice to have help. Happy to give feedback if you'd like to try.

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

Successfully merging a pull request may close this issue.

2 participants