-
Notifications
You must be signed in to change notification settings - Fork 1
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
Start rendering graph nodes #225
Conversation
✅ Deploy Preview for prefect-graphs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -26,6 +26,7 @@ function createApplication(stage: HTMLDivElement): void { | |||
application = new Application({ | |||
background: '#1099bb', | |||
resizeTo: stage, | |||
antialias: true, |
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.
Antialiasing will help, but you'll def want the resolution: window.devicePixelRatio || 2,
so that it uses the proper screen px density
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.
2 non-blocking questions, otherwise good progress!
|
||
let subscription: UseSubscription<RunGraphFetch> | null = null | ||
const { fetch: getData, stop: stopData } = graphDataFactory() | ||
const nodes = new Map<string, Graphics>() |
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.
Can you help me understand why the intermediary store of nodes here? Is this because the pixi app doesn't keep a reference of the graphics drawn to the canvas and otherwise we'd be re-rendering everything each time we got new data?
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.
The way I understand it is since we added graphics to the viewport we either need to A, remove the old graphics and draw new ones (slow) or redraw the existing graphics (faster). So keeping a reference to the graphics for each node means we can redraw them even though they've already been added to the viewport.
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.
My rough understanding. As long as the class is still in existence there is a texture and a sprite (graphics() = some utils + texture + sprite) for it whether it's on the screen or not. Actually it may still exist even if the class goes away if it hasn't been cleaned up enough.
It's like a 2d sidescroller game. You'll have textures loaded, things at the ready for when they enter the scene (a gun blast graphic graphic or something).
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.
The specific implementation here is also likely to change. I'm focused more on the patterns and logic than the actual graphics/sprites themselves at this point.
Description
Start rendering graph nodes on the graph. Also adds a consistent way for fetching graph data in different objects.