|
@@ -34,10 +34,13 @@ type
|
|
|
|
|
|
TToolPolygon = class(TVectorialTool)
|
|
|
protected
|
|
|
+ initiallyClosed : boolean;
|
|
|
function CreateShape: TVectorShape; override;
|
|
|
procedure AssignShapeStyle(AMatrix: TAffineMatrix); override;
|
|
|
procedure UpdateUserMode; virtual;
|
|
|
+ procedure ShapeValidated; override;
|
|
|
public
|
|
|
+ function ToolUp: TRect; override;
|
|
|
function ToolKeyPress(var key: TUTF8Char): TRect; override;
|
|
|
function ToolKeyDown(var key: Word): TRect; override;
|
|
|
function GetContextualToolbars: TContextualToolbars; override;
|
|
@@ -177,6 +180,7 @@ end;
|
|
|
function TToolPolygon.CreateShape: TVectorShape;
|
|
|
begin
|
|
|
result := TPolylineShape.Create(nil);
|
|
|
+ initiallyClosed := toCloseShape in Manager.ShapeOptions;
|
|
|
end;
|
|
|
|
|
|
procedure TToolPolygon.AssignShapeStyle(AMatrix: TAffineMatrix);
|
|
@@ -196,6 +200,29 @@ begin
|
|
|
if FQuickDefine then FShape.Usermode := vsuCreate;
|
|
|
end;
|
|
|
|
|
|
+procedure TToolPolygon.ShapeValidated;
|
|
|
+begin
|
|
|
+ inherited ShapeValidated;
|
|
|
+ if not initiallyClosed then
|
|
|
+ Manager.ShapeOptions := Manager.ShapeOptions - [toCloseShape];
|
|
|
+end;
|
|
|
+
|
|
|
+function TToolPolygon.ToolUp: TRect;
|
|
|
+var
|
|
|
+ opt: TShapeOptions;
|
|
|
+begin
|
|
|
+ Result:=inherited ToolUp;
|
|
|
+ if Assigned(FShape) then
|
|
|
+ begin
|
|
|
+ opt := Manager.ShapeOptions;
|
|
|
+ if (FShape as TCustomPolypointShape).Closed then
|
|
|
+ include(opt, toCloseShape)
|
|
|
+ else
|
|
|
+ exclude(opt, toCloseShape);
|
|
|
+ Manager.ShapeOptions:= opt;
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
function TToolPolygon.ToolKeyPress(var key: TUTF8Char): TRect;
|
|
|
var
|
|
|
keyCode: Word;
|