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

canvasfeature labels do not stay visible #390

Closed
nicgirault opened this Issue Nov 29, 2013 · 4 comments

Comments

Projects
None yet
3 participants
@nicgirault

nicgirault commented Nov 29, 2013

With CanvasFeature track, labels are not visible when a feature is larger than the screen whereas with the HTMLFeature track, labels have a behavior similar to the css position property with value "fixed".

@rbuels

This comment has been minimized.

Collaborator

rbuels commented Dec 2, 2013

This was almost fixed in #219, but only the arrowheads got done.

@cmdcolin

This comment has been minimized.

Contributor

cmdcolin commented Oct 6, 2015

Basic idea for this can be accomplished like this

diff --git a/src/JBrowse/View/FeatureGlyph/Box.js b/src/JBrowse/View/FeatureGlyph/Box.js
index a390244..ddcc6ec 100644
--- a/src/JBrowse/View/FeatureGlyph/Box.js
+++ b/src/JBrowse/View/FeatureGlyph/Box.js
@@ -327,8 +327,30 @@ return declare([ FeatureGlyph, FeatureLabelMixin ], {
         var fDescriptionWidth = fRect.description ? fRect.description.w : 0;
         var maxLeft = bpToPx( fMax ) - Math.max(fLabelWidth, fDescriptionWidth) - bpToPx( vMin );
         var minLeft = bpToPx( fMin ) - bpToPx( vMin );
-
+        if( fRect.label ) {
+            if( fMin <= vMin) {
+                context.font = fRect.label.font;
+                context.fillStyle = fRect.label.fill;
+                context.textBaseline = fRect.label.baseline;
+                context.fillText( fRect.label.text,
+                                  0,
+                                  fRect.t+(fRect.label.yOffset||0)
+                                );
+            }
+        }
+        if( fRect.description ) {
+            if( fMin <= vMin) {
+                context.font = fRect.description.font;
+                context.fillStyle = fRect.description.fill;
+                context.textBaseline = fRect.description.baseline;
+                context.fillText(
+                    fRect.description.text,
+                    0,
+                    fRect.t + (fRect.description.yOffset||0)
+                );
+            }
+        }

See http://gmod.827538.n3.nabble.com/Gmod-ajax-Labels-on-really-long-features-td4051495.html

@cmdcolin

This comment has been minimized.

Contributor

cmdcolin commented Oct 6, 2015

Example

tt2

This demonstrates two things

a) doesn't take the track label into account (html features moves feature label to the right to make room for track label)

b) doesn't try and remove subfeature label. some question of whether this is ok or not

@rbuels rbuels added the feature req label Jan 28, 2018

@rbuels

This comment has been minimized.

Collaborator

rbuels commented Jan 28, 2018

@cmdcolin feel like putting that patch into a pull request?? :-))))

@rbuels rbuels removed this from the Release 2.0.0 milestone Jan 28, 2018

@rbuels rbuels added the help wanted label Jan 28, 2018

@rbuels rbuels added this to the 1.12.4 milestone Jan 28, 2018

@rbuels rbuels modified the milestones: 1.12.4, 1.13.0 Feb 2, 2018

@rbuels rbuels modified the milestones: 1.13.0, 1.13.1 Mar 14, 2018

@rbuels rbuels closed this in 9b75846 Mar 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment