labels for long vectors are off screen
Closed this issue · 8 comments
Currently, a vector's label is centered along the length of the vector. This works (and looks) great in most cases, for example:
But in the Equation screen, it's possible to create some really long vectors. For example, setting the pickers to maximum values results in something like the screenshot below. And in cases like this, you can't see the labels on the sum vector or its component vectors.
@arouinfar do you want to live with this, or change the positioning algorithm for labels?
When a vector is selected, we change its label to yellow. So when a vector's label is off screen, there's also no feedback when the vector is selected.
I discussed with @arouinfar via Zoom.
We don't want to enforce the label to always be on the graph, because that will look lousy for shorter vectors that are placed near the edge of the graph. And we don't mind the user having to move the vectors if they want the labels to be on the graph.
We do want to apply the same fix to all vectors, including component vectors.
We decided to center the label on Math.min( vector.min, MAX_MAGNITUDE )
. I've currently set MAX_MAGNITUDE
to be the width of the graph, which is 50, and that seems to work nicely. If we want to do more tweaking, I'll add a query parameter.
@arouinfar please review in master or 1.0.0-dev.33.
@pixelzoom the general approach is working quite nicely.
We might also consider using the diagonal length of the graph for
MAX_MAGNITUDE
Yes, I agree. Can you update MAX_MAGNITUDE
to match the vector shown in #212 (comment)?
Adjusted as requested - this feels better. Also renamed the constant to MAX_LABEL_VECTOR_MAGITUDE
.
@arouinfar please verify in master or 1.0.0-dev.34.
👍
Looks great @pixelzoom. This was a really nice polish, thanks for suggesting!