-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 pdf support #5896
Add pdf support #5896
Conversation
81b742c
to
abd9d21
Compare
abd9d21
to
ea32b37
Compare
92164be
to
536267a
Compare
e0772f4
to
ec0545e
Compare
|
||
const hoveredQuery = defineQuery([HoveredRemoteRight]); | ||
export function pdfMenuSystem(world: HubsWorld, sceneIsFrozen: boolean) { | ||
const menu = anyEntityWith(world, PDFMenu)!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to avoid this call to anyEntityWith
.
One option is to memoize menu
, as in
let menu;
export function pdfMenuSystem(world: HubsWorld, sceneIsFrozen: boolean) {
menu = menu || anyEntityWith(world, PDFMenu)!;
...
Another option that seems nice is to set menu
in a preload
, since it feels correct to assign it as part of initialization. This commit explores that idea bbbe398 . The calling code looks like this:
let menu: EntityID;
preload(
repeatUntilTrue(() => {
menu = (window.APP && APP.world && anyEntityWith(APP.world, PDFMenu)) as EntityID;
return !!menu;
})
);
The inner function will be repeated in a setInterval
until it returns true.
I don't know the best way to handle cases like this where we are assuming that some long-lived entity will be created during initialization, and we want to hold a reference to it. I'd like to avoid sticking more things on APP
when this comes up.
For now, the simplest solution I could come up with is to just call anyEntityWith
every tick (with a !
for type coercion), even though it'll be the same entity every time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For video menu we just made a query and grabbed the first element, which is basically the same as anyEntityWith.
I definitely like the idea of doing it in a preload. The setInterval seems surprising. Ideally we should be able to do it synchronously. Maybe the functions you pass to prelaod get called after APP has been set up and passed a world. Some obviously will also be async after that, but this one shouldn't need to be.
We could also just have a way to get the world with a promise which would remove the need to modify preload.
Co-authored-by: Dominick D'Aniello <[email protected]>
acaaff0
to
f9aea69
Compare
Add support for loading pdfs with bitecs.
Also rework
coroutines
by introducingJobRunner
.