-
Notifications
You must be signed in to change notification settings - Fork 63
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 floating labels to SVG features #2781
Conversation
currently, the labels start float into position after a scroll, so might need to pass the view state to the backend renderer to make it work before scroll also not tuned for horizontally flipped yet, but that is also tricky because horizontally flipped actually renders to the feature labels on the right hand side of the feature |
454f8aa
to
cbdac1b
Compare
This PR is shaping up to be closer to completion. It is not pixel perfect, sometimes some labels can be cut off, but it is actually working pretty good. It could be that we could consider merging before pixel perfect Some key changes that have been made:
some todos: note that this PR sort of further "leans into" SVG feature rendering...the canvas is somewhat difficult to deliver right, and we could probably do ok for ourselves if we keep doing SVG |
Codecov Report
@@ Coverage Diff @@
## main #2781 +/- ##
==========================================
+ Coverage 59.69% 59.72% +0.02%
==========================================
Files 591 591
Lines 26746 26757 +11
Branches 6510 6513 +3
==========================================
+ Hits 15967 15981 +14
+ Misses 10475 10472 -3
Partials 304 304
Continue to review full report at Codecov.
|
This is somewhat smooth now. It might be that this could be passable. Can try out here Continued challenges include horizontally flipped mode, the layout of the features and calculations are a bit different in horizontally flipped, but this PR pretends that it's the same and it works mostly ok Reminder: this approach in the PR is based on the renderer, specifically making FeatureLabel an observable, and it has to deal with a mix of regionBp/featureBp/offsetPx/bpPerPx math. An alternative approach could be creating a new "layer" that is rendered using the display, similar to how the Y-scale bar is rendered on wiggle tracks, to do all this logic, and then it might be more in screen coordinates instead of offsetPx's, but it would move the "responsibility" away from the renderer and therefore might require a new display type |
seemed like this would be ok to go in, despite some possible label collisions in the horizontally flipped mode with the labels |
(just noting from what we said in meeting:)) |
Possible method for adding floating labels to svg features
Tries to address (now closed) issue #175
This tries to implement floating labels in the renderer, and detects the view's offsetpx and such in the feature label code. An alternative approach could be adding them at the display level (similar to the y-scalebar is added to the linear wiggle display) but that is not considered here
Uses some methods from the #2671 canvas renderer, but canvas features is a complex and adding this to svg would benefit existing svg use cases
Could also be used to have floating arrowheads, reducing need for chevron display indicators on exons
Base branch: #2775