]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
优化大量弹幕下的gtk弹幕窗表现
authorqydysky <qydysky@foxmail.com>
Sun, 10 Jan 2021 12:26:57 +0000 (20:26 +0800)
committerqydysky <qydysky@foxmail.com>
Sun, 10 Jan 2021 12:46:52 +0000 (20:46 +0800)
Reply/gtk.go

index e384dc773c182894fc409818873bc22d105570f1..fece5a926b2cdafea0e02e5b9abe40e94595eccc 100644 (file)
@@ -450,8 +450,12 @@ func Gtk_danmu() {
                                }
 
                                step := (max - cu) / 30
-                               if step > 0.5 && max - cu < float64(h){
-                                       if step > 5 {step = 5}
+                               if step > 20 {
+                                       if i,e := grid0.GetChildAt(0,0); e != nil{i.(*gtk.Widget).Destroy()}
+                                       if i,e := grid0.GetChildAt(1,0); e != nil{i.(*gtk.Widget).Destroy()}
+                                       grid0.RemoveRow(0)
+                               } else if step > 0.5 {
+                                       if step > 5{step = 5}
                                        tmp.SetValue(cu + step)
                                } else {
                                        in_smooth_roll = false