mirror of
https://github.com/danbulant/cushy
synced 2026-07-05 03:00:43 +00:00
Optimizing label text recaching
I had previously had similar logic in here, but I realized I couldn't reliably detect if cosmic_text had done any wrapping or not. After a discussion prompted me to see if recaching was happening while scrolling, I realized I could at least allow the width to be >= the measured text size and <= the requested layout width. This prevents recaching while scrolling.
This commit is contained in:
parent
20ae2b7c72
commit
5e266f1551
1 changed files with 2 additions and 1 deletions
|
|
@ -52,7 +52,8 @@ where
|
||||||
if cache.text.can_render_to(&context.gfx)
|
if cache.text.can_render_to(&context.gfx)
|
||||||
&& cache.generation == check_generation
|
&& cache.generation == check_generation
|
||||||
&& cache.color == color
|
&& cache.color == color
|
||||||
&& cache.width == width
|
&& width <= cache.width
|
||||||
|
&& cache.text.size.width <= width
|
||||||
&& cache.families == current_families => {}
|
&& cache.families == current_families => {}
|
||||||
_ => {
|
_ => {
|
||||||
let measured = self.display.map(|text| {
|
let measured = self.display.map(|text| {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue