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

app: fix chatview since gfx Move command was changed to be relative. Use its SetPos replacement instead

darkfi 1 год назад
Родитель
Сommit
8ba86f6868
2 измененных файлов с 7 добавлено и 1 удалено
  1. 6 0
      bin/app/src/gfx/mod.rs
  2. 1 1
      bin/app/src/ui/chatview/mod.rs

+ 6 - 0
bin/app/src/gfx/mod.rs

@@ -465,6 +465,12 @@ impl<'a> RenderContext<'a> {
                 DrawInstruction::ApplyView(view) => {
                     // Adjust view relative to cursor
                     self.view = *view + self.cursor;
+                    // We could just skip drawing when clipping rect isn't visible
+                    // using an is_visible flag.
+                    match self.view.clip(&old_view) {
+                        Some(clipped) => self.view = clipped,
+                        None => self.view = Rectangle::zero()
+                    }
                     // Cursor resets within the view
                     self.cursor = Point::zero();
                     if is_debug {

+ 1 - 1
bin/app/src/ui/chatview/mod.rs

@@ -684,7 +684,7 @@ impl ChatView {
             let off_y = (scroll + start_pos - y_pos);
             let pos = Point::from([0., off_y]);
 
-            instrs.push(GfxDrawInstruction::Move(pos));
+            instrs.push(GfxDrawInstruction::SetPos(pos));
             instrs.push(GfxDrawInstruction::Draw(mesh));
         }