|
@@ -90,7 +90,7 @@ type
|
|
procedure OnClickPoint({%H-}ASender: TObject; APointIndex: integer; {%H-}AShift: TShiftState); virtual;
|
|
procedure OnClickPoint({%H-}ASender: TObject; APointIndex: integer; {%H-}AShift: TShiftState); virtual;
|
|
procedure DoClickPoint({%H-}APointIndex: integer; {%H-}AShift: TShiftState); virtual;
|
|
procedure DoClickPoint({%H-}APointIndex: integer; {%H-}AShift: TShiftState); virtual;
|
|
function CanMovePoints: boolean; virtual;
|
|
function CanMovePoints: boolean; virtual;
|
|
- procedure InsertPointAuto;
|
|
|
|
|
|
+ procedure InsertPointAuto(AShift: TShiftState);
|
|
function ComputeStroke(APoints: ArrayOfTPointF; AClosed: boolean;
|
|
function ComputeStroke(APoints: ArrayOfTPointF; AClosed: boolean;
|
|
AStrokeMatrix: TAffineMatrix): ArrayOfTPointF; override;
|
|
AStrokeMatrix: TAffineMatrix): ArrayOfTPointF; override;
|
|
public
|
|
public
|
|
@@ -645,11 +645,12 @@ begin
|
|
result := true;
|
|
result := true;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TCustomPolypointShape.InsertPointAuto;
|
|
|
|
|
|
+procedure TCustomPolypointShape.InsertPointAuto(AShift: TShiftState);
|
|
var
|
|
var
|
|
bestSegmentIndex, i: Integer;
|
|
bestSegmentIndex, i: Integer;
|
|
- bestSegmentDist, segmentLen, segmentPos: single;
|
|
|
|
- u, n: TPointF;
|
|
|
|
|
|
+ bestSegmentDist,
|
|
|
|
+ segmentLen, segmentPos: single;
|
|
|
|
+ u, n, bestProjection: TPointF;
|
|
segmentDist: single;
|
|
segmentDist: single;
|
|
begin
|
|
begin
|
|
if isEmptyPointF(FMousePos) then exit;
|
|
if isEmptyPointF(FMousePos) then exit;
|
|
@@ -659,6 +660,7 @@ begin
|
|
|
|
|
|
bestSegmentIndex := -1;
|
|
bestSegmentIndex := -1;
|
|
bestSegmentDist := MaxSingle;
|
|
bestSegmentDist := MaxSingle;
|
|
|
|
+ bestProjection := EmptyPointF;
|
|
for i := 0 to PointCount-1 do
|
|
for i := 0 to PointCount-1 do
|
|
if FAddingPoint and (i >= PointCount-2) then break else
|
|
if FAddingPoint and (i >= PointCount-2) then break else
|
|
begin
|
|
begin
|
|
@@ -677,13 +679,17 @@ begin
|
|
begin
|
|
begin
|
|
bestSegmentDist := segmentDist;
|
|
bestSegmentDist := segmentDist;
|
|
bestSegmentIndex := i;
|
|
bestSegmentIndex := i;
|
|
|
|
+ bestProjection := Points[i]+segmentPos*u;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
if bestSegmentIndex <> -1 then
|
|
if bestSegmentIndex <> -1 then
|
|
begin
|
|
begin
|
|
- InsertPoint(bestSegmentIndex+1, FMousePos);
|
|
|
|
|
|
+ if ssShift in AShift then
|
|
|
|
+ InsertPoint(bestSegmentIndex+1, bestProjection)
|
|
|
|
+ else
|
|
|
|
+ InsertPoint(bestSegmentIndex+1, FMousePos);
|
|
FHoverPoint:= bestSegmentIndex+1;
|
|
FHoverPoint:= bestSegmentIndex+1;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -816,7 +822,7 @@ begin
|
|
RemovePoint(PointCount-2);
|
|
RemovePoint(PointCount-2);
|
|
AHandled:= true;
|
|
AHandled:= true;
|
|
end else
|
|
end else
|
|
- if (Key = skInsert) then InsertPointAuto else
|
|
|
|
|
|
+ if (Key = skInsert) then InsertPointAuto(Shift) else
|
|
inherited KeyDown(Shift, Key, AHandled);
|
|
inherited KeyDown(Shift, Key, AHandled);
|
|
end;
|
|
end;
|
|
|
|
|