-
Robert Knight authored
Re-implement the behavior to scroll newly created annotations into view in the sidebar so that the user can start editing them immediately. A complication with doing this given that the annotation list is virtualized is that if we want to scroll to the Nth visible annotation, we may not know the actual heights of the N-1 annotations above it. As a result of scrolling the list, some of the heights of those N-1 annotations may be updated from an estimate to an actual measured height, changing the Y offset that we want to scroll to in order to make the Nth annotation visible. There are a few strategies that we could use for dealing with this: 1. Forcibly render all N-1 annotations and measure their height. This is prohibitively expensive for long annotation lists. 2. Use a cheaper method to calculate the exact height of an annotation. Unfortunately we don't have a way to do this at the moment. 3. Use an iterative approach: a. Estimate the target position based on current known/guessed heights. b. Scroll to the estimated position, which will trigger re-rendering and possibly alter the known thread heights. c. Re-estimate the target position and if it changed, go to step b. This commit implements the third method.
d0876bbd