소스 검색

assign line cap to curve, fix bounds for square cap

Johann 5 년 전
부모
커밋
8ae828bbb5
2개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  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;