Adder points outside the selected text
In some situations the up/down-pointing arrow in the adder is positioned incorrectly and does not point at the end of the selection as expected. This happens when switching between making a selection that contains no existing highlights, and making a selection that does contain an existing highlight.
Steps to reproduce
- Select a small portion of text that doesn't contain a highlight
- Select another portion of text that already contains a highlight
Expected behaviour
The adder should point towards the last portion of the selected text in both cases.
Actual behaviour
The adder in the second selection points out of the selected text.
https://user-images.githubusercontent.com/8555781/114714938-ddcc2000-9d32-11eb-8029-971ebff7cc16.mov
Additional details
When selecting text that already contains annotations the adder shows an extra button Show X which adds to the overall dimension of the adder. After the annotation is created the adder is hidden but the dimensions of the adder is retained.
The calculation for the placement of the adder is based on the dimensions of the previously shown adder. Selecting alternatively between text that contains highlights or not, exposes this behaviour.
One solution could be:
- While the adder is still hidden, toggle off/on the
Show X, depending if the selected text contains highlights. - Calculate the size of the adder and, based on that, the placement of the adder.
- Show the adder.