Browse Source

update function calls related to transform

johann 5 years ago
parent
commit
10a97a1e0c
1 changed files with 14 additions and 4 deletions
  1. 14 4
      vectoredit/umain.pas

+ 14 - 4
vectoredit/umain.pas

@@ -212,6 +212,7 @@ type
     FFullIconHeight: integer;
     FFullIconHeight: integer;
     FVectorImageList: TBGRAImageList;
     FVectorImageList: TBGRAImageList;
     procedure ComboBoxSplineStyleClick(Sender: TObject);
     procedure ComboBoxSplineStyleClick(Sender: TObject);
+    function GetOriginalZoomFactor: single;
     function GetOutlineWidth: single;
     function GetOutlineWidth: single;
     function GetPenStyle: TBGRAPenStyle;
     function GetPenStyle: TBGRAPenStyle;
     function GetPenWidth: single;
     function GetPenWidth: single;
@@ -320,6 +321,7 @@ type
     property currentTool: TPaintTool read FCurrentTool write SetCurrentTool;
     property currentTool: TPaintTool read FCurrentTool write SetCurrentTool;
     property joinStyle: TPenJoinStyle read FPenJoinStyle write SetPenJoinStyle;
     property joinStyle: TPenJoinStyle read FPenJoinStyle write SetPenJoinStyle;
     property phongShapeKind: TPhongShapeKind read FPhongShapeKind write SetPhongShapeKind;
     property phongShapeKind: TPhongShapeKind read FPhongShapeKind write SetPhongShapeKind;
+    property originalZoomFactor: single read GetOriginalZoomFactor;
     property zoomFactor: single read GetZoomFactor write SetZoomFactor;
     property zoomFactor: single read GetZoomFactor write SetZoomFactor;
     property vectorOriginal: TVectorOriginal read GetVectorOriginal;
     property vectorOriginal: TVectorOriginal read GetVectorOriginal;
     property vectorLayerIndex: integer read FVectorLayerIndex write SetVectorLayerIndex;
     property vectorLayerIndex: integer read FVectorLayerIndex write SetVectorLayerIndex;
@@ -863,7 +865,7 @@ begin
         vectorOriginal.SelectShape(addedShape);
         vectorOriginal.SelectShape(addedShape);
         currentTool:= ptHand;
         currentTool:= ptHand;
       end else
       end else
-        vectorOriginal.MouseClick(newStartPoint);
+        vectorOriginal.MouseClick(newStartPoint, DoScaleX(6, 96)/zoomFactor*originalZoomFactor);
       justDown:= false;
       justDown:= false;
     end
     end
     else if Assigned(newShape) and (Button = newButton) then
     else if Assigned(newShape) and (Button = newButton) then
@@ -1090,6 +1092,14 @@ begin
   end;
   end;
 end;
 end;
 
 
+function TForm1.GetOriginalZoomFactor: single;
+var
+  m: TAffineMatrix;
+begin
+  m := vectorTransform;
+  result := (VectLen(PointF(m[1,1],m[2,1]))+VectLen(PointF(m[1,2],m[2,2])))/2;
+end;
+
 function TForm1.GetOutlineWidth: single;
 function TForm1.GetOutlineWidth: single;
 begin
 begin
   result := FOutlineWidth;
   result := FOutlineWidth;
@@ -2293,14 +2303,14 @@ end;
 procedure TForm1.DoCopy;
 procedure TForm1.DoCopy;
 begin
 begin
   if Assigned(vectorOriginal) and Assigned(vectorOriginal.SelectedShape) then
   if Assigned(vectorOriginal) and Assigned(vectorOriginal.SelectedShape) then
-    CopyShapesToClipboard([vectorOriginal.SelectedShape]);
+    CopyShapesToClipboard([vectorOriginal.SelectedShape], vectorTransform);
 end;
 end;
 
 
 procedure TForm1.DoCut;
 procedure TForm1.DoCut;
 begin
 begin
   if Assigned(vectorOriginal) and Assigned(vectorOriginal.SelectedShape) then
   if Assigned(vectorOriginal) and Assigned(vectorOriginal.SelectedShape) then
   begin
   begin
-    if CopyShapesToClipboard([vectorOriginal.SelectedShape]) then
+    if CopyShapesToClipboard([vectorOriginal.SelectedShape], vectorTransform) then
       vectorOriginal.SelectedShape.Remove;
       vectorOriginal.SelectedShape.Remove;
   end;
   end;
 end;
 end;
@@ -2308,7 +2318,7 @@ end;
 procedure TForm1.DoPaste;
 procedure TForm1.DoPaste;
 begin
 begin
   if Assigned(vectorOriginal) then
   if Assigned(vectorOriginal) then
-    PasteShapesFromClipboard(vectorOriginal);
+    PasteShapesFromClipboard(vectorOriginal, vectorTransform);
 end;
 end;
 
 
 procedure TForm1.DoDelete;
 procedure TForm1.DoDelete;