Skip to content
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

Automatic label anchor (rebased) #842

Closed
wants to merge 41 commits into from

Conversation

karimnaaji
Copy link
Member

@karimnaaji karimnaaji commented Jul 19, 2016

Rebase of #806

  • Update unit tests
  • Update syntax:
    • single value: anchor: top,
    • multiple values: anchor: [right, bottom, left, top]
  • Set defaults according to JS
  • parse YAML list

Optimizations

Bugs
- [ ] label offset does not work (check bubble-wrap with debug_all_labels)

Notes:
Label now stores a set of Anchors which are defined by the anchor-style parameter
https://github.com/tangrams/tangram-es/pull/842/files#diff-7d439434d5d36de1c37a6cb2f01b81aaR37.

When a label got occluded (or couldn't be placed when its tile becomes active) the label state changes from visible/(none) -> fallback and the next anchor position is tried on the next frame until all positions have been tried or the label could be placed.
https://github.com/tangrams/tangram-es/pull/842/files#diff-d66207e00a5f8416ddf6f8aea50052dcR284

A TextLabel now stores quads for left/right/center alignments which are chosen to match the currently active Anchor. https://github.com/tangrams/tangram-es/pull/842/files#diff-1fd6c9d719003eb34d010a7063a941e7R38, https://github.com/tangrams/tangram-es/pull/842/files#diff-4cb2204fedb2ba4ea43314c75ab033f0R204

@karimnaaji karimnaaji mentioned this pull request Jul 19, 2016
1 task
@hjanetzek hjanetzek force-pushed the karim/rb-automatic-label-anchor branch 3 times, most recently from 52bbcee to c4f98e2 Compare July 21, 2016 16:00
@karimnaaji karimnaaji force-pushed the karim/rb-automatic-label-anchor branch 2 times, most recently from de15719 to 556dd49 Compare July 22, 2016 13:17
@hjanetzek hjanetzek force-pushed the karim/rb-automatic-label-anchor branch from f8e03b6 to ae36dc7 Compare July 22, 2016 15:33
@hjanetzek hjanetzek force-pushed the karim/rb-automatic-label-anchor branch from e4db674 to 166c636 Compare July 25, 2016 12:27
@karimnaaji karimnaaji force-pushed the karim/rb-automatic-label-anchor branch 2 times, most recently from 656690f to 95c1201 Compare July 25, 2016 22:39
@karimnaaji
Copy link
Member Author

Both @hjanetzek and me are happy with the state of this branch, @tallytalwar can you give a quick review on this.

@karimnaaji karimnaaji assigned tallytalwar and unassigned hjanetzek Jul 25, 2016
@karimnaaji karimnaaji force-pushed the karim/rb-automatic-label-anchor branch from 39eddae to fd7bcad Compare July 25, 2016 22:47
@tallytalwar
Copy link
Member

Will get to reviewing this soon.
Do you want to do a cleanup of the git history here? I see some specific "fix", "squash" commits here.

@hjanetzek hjanetzek force-pushed the karim/rb-automatic-label-anchor branch 2 times, most recently from 49b58e3 to a0da5ae Compare July 29, 2016 12:42
@hjanetzek hjanetzek force-pushed the karim/rb-automatic-label-anchor branch from a0da5ae to 3a0e912 Compare August 1, 2016 09:28
hjanetzek and others added 15 commits August 1, 2016 11:36
squash: remove unused include
squashed:
- parse label anchor style string only once
- fix packing of active label quads
- fixup: missing alignment from first anchor
- use direct mapping between Align enum and m_textRangeIndex position
- fixup: uninitialized variables
label could have been hidden for a few frames (trying all fallbacks).
fading it out does not make sense then
squashed
- cleanup: use initializer-list (required gcc >= 5)
- m_occludedLastFrame was necessary for _onlyTransitions pass which
  did not keep the m_occluded state of the previous frame
  (fixed with labels.cpp:83)
@hjanetzek hjanetzek force-pushed the karim/rb-automatic-label-anchor branch from 3a0e912 to bb67c0e Compare August 1, 2016 09:40
@tallytalwar
Copy link
Member

tallytalwar commented Aug 1, 2016

There are a bunch of conceptual changes here, can we document these in the PR description please? Will help reviewing this and also for debugging in future.

@hjanetzek
Copy link
Member

@tallytalwar added some notes to the PR description.

@hjanetzek
Copy link
Member

hjanetzek commented Aug 2, 2016

@karimnaaji thinking about the fallback logic again: why not try the fallbacks immediately instead of waiting for the next frame? I'll see if this works.

Edit: I guess this was just not possible before the changes of tile-label-placement got merged which introduced incremental collision testing.

@hjanetzek hjanetzek mentioned this pull request Aug 3, 2016
4 tasks
@tallytalwar
Copy link
Member

Good to go.

@hjanetzek
Copy link
Member

Continuing at #893

@hjanetzek hjanetzek closed this Aug 8, 2016
@karimnaaji karimnaaji deleted the karim/rb-automatic-label-anchor branch August 17, 2016 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants