浏览代码

Only call that method once

Brandon Thetford 1 年之前
父节点
当前提交
5ca5b541d7
共有 1 个文件被更改,包括 28 次插入26 次删除
  1. 28 26
      Terminal.Gui/Views/Slider.cs

+ 28 - 26
Terminal.Gui/Views/Slider.cs

@@ -773,37 +773,39 @@ public class Slider<T> : View
             return;
             return;
         }
         }
 
 
+        Thickness adornmentsThickness = GetAdornmentsThickness ();
+
         if (_config._sliderOrientation == Orientation.Horizontal)
         if (_config._sliderOrientation == Orientation.Horizontal)
         {
         {
-            Bounds = new Rectangle (
-                               Bounds.Location,
-                               new Size (
-                                         int.Min (
-                                                  SuperView.Bounds.Width - GetAdornmentsThickness ().Horizontal,
-                                                  CalcBestLength ()
-                                                 ),
-                                         int.Min (
-                                                  SuperView.Bounds.Height - GetAdornmentsThickness ().Vertical,
-                                                  CalcThickness ()
-                                                 )
-                                        )
-                              );
+            Bounds = new (
+                          Bounds.Location,
+                          new (
+                               int.Min (
+                                        SuperView.Bounds.Width - adornmentsThickness.Horizontal,
+                                        CalcBestLength ()
+                                       ),
+                               int.Min (
+                                        SuperView.Bounds.Height - adornmentsThickness.Vertical,
+                                        CalcThickness ()
+                                       )
+                              )
+                         );
         }
         }
         else
         else
         {
         {
-            Bounds = new Rectangle (
-                               Bounds.Location,
-                               new Size (
-                                         int.Min (
-                                                  SuperView.Bounds.Width - GetAdornmentsThickness ().Horizontal,
-                                                  CalcThickness ()
-                                                 ),
-                                         int.Min (
-                                                  SuperView.Bounds.Height - GetAdornmentsThickness ().Vertical,
-                                                  CalcBestLength ()
-                                                 )
-                                        )
-                              );
+            Bounds = new (
+                          Bounds.Location,
+                          new (
+                               int.Min (
+                                        SuperView.Bounds.Width - adornmentsThickness.Horizontal,
+                                        CalcThickness ()
+                                       ),
+                               int.Min (
+                                        SuperView.Bounds.Height - adornmentsThickness.Vertical,
+                                        CalcBestLength ()
+                                       )
+                              )
+                         );
         }
         }
     }
     }