-
Notifications
You must be signed in to change notification settings - Fork 240
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
[wip] Automatic label anchor #806
Conversation
- move quads, copying only used quads on the caller side
- this caused way too many labels in isect2d buckets
- having it inlined should give the compiler some options to optimize - todo: test if compiler is smart enough to omit 2 divisions
- major speedup compared to collecting all possible collisions first
- allows easier perf tracing for each phase
- So anchor fallback state would be able to switch between different text alignments
- TODO: update unit tests for line wraps
This is cool! For syntax, while it's in some ways a little less friendly, I'd prefer to use a YAML list to specify multiple anchors. While it's more verbose, it's more consistent with how we've handled single vs. multiple values for other parameters, and it's more explicit and only uses built-in YAML processing vs. being dependent on additional string parsing, e.g. both are valid: Single value: |
I'll make an issue for this for JS. Note that initially we may have to just stub this out, making it take the first specified anchor value and ignore the rest (but accept this syntax rather than failing to parse the feature, for scene file compatibility). |
Closing in favor of #842 |
Support for automatic anchoring fallbacks (based off #749).
Defined in the stylesheet as the following (series of fallback separated by commas):
For any labels with potential anchor fallbacks, when a collision happens a label would enter in the
anchor_fallback
state atframe n
, they would enter within this state, the collision system will then try their new position atframe n+1
, if no collision happens, they would then get to theirvisible
state, otherwise they would keep trying the next fallbacks on the next frames until they have looped on all of them.Anchor fallback and dynamic text realignment
align:
property is given, the fallback would automatically realign the text;right
, automatic realignment toleft
bottom
, automatic realignment tocenter
align:
property is given, the preferred alignment would be assigned to every anchor fallback.To implement realignment when anchor is being switched, the text quads are being drawn for each of the fallbacks (so quads would be correctly positioned for each of the fallbacks). Then a list of quad ranges associated with their alignment are being given to the text label so it can switch between the quad ranges at render time.
To improve determinism
When a label is colliding and fallbacks to the next anchor, it would stick to this anchor until a new collision happens (where it should fallback to the preferred anchor when space is again available):
TODO