Jelajahi Sumber

fix text update when font/style/shadow changes

Johann ELSASS 4 tahun lalu
induk
melakukan
999f1ea083
2 mengubah file dengan 13 tambahan dan 4 penghapusan
  1. 3 2
      lazpaint/tools/utooltext.pas
  2. 10 2
      lazpaintcontrols/lcvectortextshapes.pas

+ 3 - 2
lazpaint/tools/utooltext.pas

@@ -163,8 +163,9 @@ begin
     PenPhong := Manager.TextPhong;
   end;
   if (Manager.TextShadow <> FPrevShadow) or
-     (Manager.TextShadowBlurRadius <> FPrevShadowRadius) or
-     (Manager.TextShadowOffset <> FPrevShadowOffset) then
+     (FPrevShadow and
+     ((Manager.TextShadowBlurRadius <> FPrevShadowRadius) or
+     (Manager.TextShadowOffset <> FPrevShadowOffset))) then
   begin
     toolDest := GetToolDrawingLayer;
     r:= UpdateShape(toolDest);

+ 10 - 2
lazpaintcontrols/lcvectortextshapes.pas

@@ -152,6 +152,7 @@ type
     function HasOutline: boolean;
     procedure InsertUnicodeValue;
     procedure FillChange(ASender: TObject; var ADiff: TCustomVectorialFillDiff); override;
+    procedure InvalidateAll;
   public
     constructor Create(AContainer: TVectorOriginal); override;
     procedure QuickDefine(constref APoint1,APoint2: TPointF); override;
@@ -551,6 +552,7 @@ begin
   if FFontBidiMode=AValue then Exit;
   BeginUpdate(TTextShapeFontDiff);
   FFontBidiMode:=AValue;
+  InvalidateAll;
   EndUpdate;
 end;
 
@@ -718,7 +720,7 @@ begin
   if FFontName=AValue then Exit;
   BeginUpdate(TTextShapeFontDiff);
   FFontName:=AValue;
-  if Assigned(FTextLayout) then FTextLayout.InvalidateLayout;
+  InvalidateAll;
   EndUpdate;
 end;
 
@@ -727,7 +729,7 @@ begin
   if FFontStyle=AValue then Exit;
   BeginUpdate(TTextShapeFontDiff);
   FFontStyle:=AValue;
-  if Assigned(FTextLayout) then FTextLayout.InvalidateLayout;
+  InvalidateAll;
   EndUpdate;
 end;
 
@@ -1065,6 +1067,12 @@ begin
   inherited FillChange(ASender, ADiff);
 end;
 
+procedure TTextShape.InvalidateAll;
+begin
+  if Assigned(FTextLayout) then FTextLayout.InvalidateLayout;
+  FParagraphLayout := nil;
+end;
+
 constructor TTextShape.Create(AContainer: TVectorOriginal);
 begin
   inherited Create(AContainer);