boxfit icon indicating copy to clipboard operation
boxfit copied to clipboard

use binary searching algorithm if max font value set

Open RMaksymczuk opened this issue 10 years ago • 0 comments

Hey,

We have this project in which we're using infinity scrolling with your boxfit plugin. I noticed that for a large number of components which are using this solution, it is noticeably for a user that text is blinking. I also noticed that for searching proper font size, for each element, I need to make ~25 loop steps. So the idea was to use some searching algorithm to reduce number of steps and comparisons. For that I used the binary searching algorithm, whereby the number of steps decreased to ~3. The only requirement is to have both, minimum and maximum font size set.

In pull request I depend my algorithm to settings.maximum_font_size, so it will run only for user who have set that value and for another situations, the old algorithm will be used. If you like my solution, I think we can go on. Maybe there is a possibility to set some default number for maximum_font_size, so it can always use binary algorithm.

Would be nice to know your opinion,

Greetings, Rafal

RMaksymczuk avatar Jan 12 '15 01:01 RMaksymczuk