reworked Label class
Created by: leezh
- no longer inherits Range - instead, more sensible function names controlling lines visible
- more accurate vertical alignment
- percent_visible preserved even after setting new text
Largely motivated by the frustratingly inaccurate vertical alignment, particularly with large fonts. Before: https://gfycat.com/WaterySimpleHornedtoad After: https://gfycat.com/NeighboringMetallicKilldeer
The code for controlling the lines visible was already there, but I changed it so that instead of using set_val()
and set_max()
you now use set_lines_skipped()
and set_max_lines_visible()
.
Also, percent_visible
and visible_chars
are now recalculated properly each time you use set_text()
because that could change the total length, and when you use set_visible_characters()
.