瀏覽代碼

fix text toolbar scaling

Juliette ELSASS 1 年之前
父節點
當前提交
c216a83044
共有 2 個文件被更改,包括 17 次插入1 次删除
  1. 4 0
      lazpaint/lazpaintmainform.pas
  2. 13 1
      lazpaint/maintoolbar.inc

+ 4 - 0
lazpaint/lazpaintmainform.pas

@@ -974,6 +974,7 @@ begin
   CreateToolbarElements;
   FLayout.DarkTheme := Config.GetDarkTheme;
   DarkThemeInstance.Apply(Panel_PenWidthPreview, Config.GetDarkTheme);
+  DarkThemeInstance.Apply(Panel_TextMore, Config.GetDarkTheme);
 end;
 
 function TFMain.GetToolManager: TToolManager;
@@ -1208,6 +1209,9 @@ begin
 
     SVGImageList1.Width := iconSize;
     SVGImageList1.Height := iconSize;
+    SVGImageList1.PopulateImageList(SVGRasterImageList1, [iconSize]);
+    ToolBar25.ButtonWidth:= iconSize + DoScaleX(4, OriginalDPI, toolbarDPI);
+    ToolBar25.ButtonHeight:= iconSize + DoScaleY(4, OriginalDPI, toolbarDPI);
     Button_Donate.Images := m.ImageList;
     w := Button_Donate.Width; h := Button_Donate.Height;
     Button_Donate.GetPreferredSize(w, h);

+ 13 - 1
lazpaint/maintoolbar.inc

@@ -127,7 +127,6 @@ begin
   Tool_TextPhong.OnClick := @Tool_TextPhongClick;
   Tool_TextShadow.OnClick := @Tool_TextShadowClick;
   Tool_TextOutline.OnClick := @Tool_TextOutlineClick;
-  Panel_TextMore.AutoSize := true;
   Panel_ToolbarBackground.OnMouseMove := @Panel_ToolbarBackgroundMouseMove;
   TimerHidePenPreview.OnTimer := @TimerHidePenPreviewTimer;
   TimerHideTextMore.OnTimer := @TimerHideTextMoreTimer;
@@ -1582,9 +1581,22 @@ begin
 end;
 
 procedure TFMain.ShowTextMore;
+var
+  w, h: Integer;
 begin
   if not Panel_TextMore.Visible then
   begin
+    ToolBar25.AutoSize := false;
+    w := ToolBar25.Width;
+    h := ToolBar25.Height;
+    ToolBar25.GetPreferredSize(w, h);
+    ToolBar25.Width := w;
+    ToolBar25.Height := h;
+    ToolBar25.Left := DoScaleX(2, 96);
+    ToolBar25.Top := DoScaleX(2, 96);
+
+    Panel_TextMore.Width := ToolBar25.Width + DoScaleX(4, 96);
+    Panel_TextMore.Height := ToolBar25.Height + DoScaleX(4, 96);
     Panel_TextMore.Left := min(Panel_Text.Left, ClientWidth-Panel_TextMore.Width);
     Panel_TextMore.Top := Panel_Text.Top+Panel_Text.Height;
     Panel_TextMore.Visible := True;