#1704 Optimize Annotations' position update #1761
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have mixed feelings about this change.We might want to look for a performance improvement that doesn't require setting an extra flag and potentially (though unlikely) sacrificing some positioning precision.
That might involve a different method of rendering a marker though.
Hopefully a huge number of Annotations, which makes this performance improvement necessary, is not a very common case.
Previous approach, required an explicit user call to take advantage of the optimization.
I've changed the approach to instead automatically rely on cached widths values (which are expensive to obtain), and postpone the expensive calculations by some timeout.
This way the calculations don't interfere with e.g. interactive camera manipulation, and are delayed to after the camera manipulation stops.
Even though cached values might not represent actual widths while the calculation is delayed, that shouldn't be a practical problem.