Просмотр исходного кода

wallet/chatedit: make the scrolling fades much less aggro

darkfi 1 год назад
Родитель
Сommit
005abff8ca
1 измененных файлов с 5 добавлено и 4 удалено
  1. 5 4
      bin/darkwallet/src/ui/chatedit.rs

+ 5 - 4
bin/darkwallet/src/ui/chatedit.rs

@@ -615,7 +615,7 @@ impl ChatEdit {
 
         //self_.text_wrap.lock().editable.set_text(
         //    "".to_string(),
-        //    "A berry is a small, pulpy, and often edible fruit. Typically, berries are juicy, rounded, brightly colored, sweet, sour or tart, and do not have a stone or pit, although many pips or seeds may be present. Common examples of berries in the culinary sense are strawberries, raspberries, blueberries, blackberries, white currants, blackcurrants, and redcurrants.In Britain, soft fruit is a horticultural term for such fruits.".to_string()
+        //    "A berry is a small, pulpy, and often edible fruit. Typically, berries are juicy, rounded, brightly colored, sweet, sour or tart, and do not have a stone or pit, although many pips or seeds may be present. Common examples of berries in the culinary sense are strawberries, raspberries, blueberries, blackberries, white currants, blackcurrants, and redcurrants. In Britain, soft fruit is a horticultural term for such fruits.".to_string()
         //);
         //self_
         //    .text_wrap
@@ -733,13 +733,14 @@ impl ChatEdit {
                 }
 
                 // Some kewl styling
-                let top_y = (line_idx + 1) as f32 * linespacing - baseline - scroll;
+                let top_y = line_idx as f32 * linespacing + baseline - font_size - scroll;
                 if top_y < 0. {
                     let pct = 1. + (top_y / baseline).clamp(-1., 0.);
                     color[3] = pct;
                 }
-                let bottom_y = top_y + linespacing;
-                let bottom_rect = clip.h - linespacing + baseline;
+                //let bottom_y = top_y + linespacing;
+                let bottom_y = (line_idx + 1) as f32 * linespacing - scroll;
+                let bottom_rect = clip.h;
                 if bottom_y > bottom_rect {
                     let dist = bottom_y - bottom_rect;
                     let pct = 1. - (dist / linespacing).clamp(0., 1.);