Skip to content

Conversation

@cmdcolin
Copy link
Collaborator

@cmdcolin cmdcolin commented Dec 9, 2025

Background

The LinearSyntenyView renders all the data in the main thread. It downloads all the data to the main thread using CoreGetFeatures and then renders it on every frame.

This PR

This PR changes the rendering to happen in the web worker

It uses transferControlToOffscreen (https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/transferControlToOffscreen) to let the webworker draw straight to the main thread's DOM canvas

Caveat

This is currently significantly less 'smooth' on scrolling, but this could probably be worked on further, and the effect of not bogging down the main thread with extremely slow rendering probably is worth it

@cmdcolin
Copy link
Collaborator Author

cmdcolin commented Dec 9, 2025

Fixes #4616

@cmdcolin
Copy link
Collaborator Author

Example share link using this branch

https://jbrowse.org/code/jb2/refactor_abstract_canvas_renderers/?config=test_data%2Fconfig_synteny_grape_peach.json&session=share-kS1dLgjWnZ&password=ar5c5

can see the synteny rendering lags a little behind but it doesn't 'feel too bad' from a user experience perspective since the interface stays responsive

@cmdcolin cmdcolin marked this pull request as draft December 10, 2025 18:51
@cmdcolin
Copy link
Collaborator Author

marked as draft. will need to incorporate stop tokens and improved synchronization (the renderer should respond with what it rendered to help the main thread confirm that that the rendering is relevant)

@cmdcolin cmdcolin marked this pull request as ready for review December 16, 2025 23:05
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 this pull request may close these issues.

2 participants