Browse Source

assign line cap to curve, fix bounds for square cap

Johann 5 years ago
parent
commit
8ae828bbb5
2 changed files with 6 additions and 1 deletions
  1. 1 1
      lazpaint/tools/utoolpolygon.pas
  2. 5 0
      lazpaintcontrols/lcvectorpolyshapes.pas

+ 1 - 1
lazpaint/tools/utoolpolygon.pas

@@ -296,7 +296,7 @@ begin
   TCustomPolypointShape(FShape).ArrowStartKind := Manager.ArrowStart;
   TCustomPolypointShape(FShape).ArrowEndKind := Manager.ArrowEnd;
   TCustomPolypointShape(FShape).ArrowSize := Manager.ArrowSize;
-  if not (self is TToolSpline) then TCustomPolypointShape(FShape).LineCap:= Manager.LineCap;
+  TCustomPolypointShape(FShape).LineCap:= Manager.LineCap;
   UpdateUserMode;
 end;
 

+ 5 - 0
lazpaintcontrols/lcvectorpolyshapes.pas

@@ -1232,6 +1232,11 @@ begin
       begin
         xMargin := (abs(AMatrix[1,1])+abs(AMatrix[1,2]))*PenWidth*0.5;
         yMargin := (abs(AMatrix[2,1])+abs(AMatrix[2,2]))*PenWidth*0.5;
+        if LineCap = pecSquare then
+        begin
+          xMargin *= sqrt(2);
+          yMargin *= sqrt(2);
+        end;
         result := GetPointsBoundsF(pts);
         result.Left -= xMargin;
         result.Top -= yMargin;