소스 검색

return to finish polypoint shape

circular17 6 년 전
부모
커밋
d1426b7ce2
1개의 변경된 파일14개의 추가작업 그리고 0개의 파일을 삭제
  1. 14 0
      lazpaint/tools/utoolpolygon.pas

+ 14 - 0
lazpaint/tools/utoolpolygon.pas

@@ -39,6 +39,7 @@ type
     procedure UpdateUserMode; virtual;
   public
     function ToolKeyPress(var key: TUTF8Char): TRect; override;
+    function ToolKeyDown(var key: Word): TRect; override;
     function GetContextualToolbars: TContextualToolbars; override;
   end;
 
@@ -211,6 +212,19 @@ begin
     Result:=inherited ToolKeyPress(key);
 end;
 
+function TToolPolygon.ToolKeyDown(var key: Word): TRect;
+begin
+  if (key = VK_RETURN) and Assigned(FShape)
+   and (FShape.Usermode = vsuCreate) then
+  begin
+    FShape.Usermode:= vsuEdit;
+    result := OnlyRenderChange;
+    key := 0;
+    exit;
+  end else
+    Result:=inherited ToolKeyDown(key);
+end;
+
 function TToolPolygon.GetContextualToolbars: TContextualToolbars;
 begin
   Result:= [ctColor,ctTexture,ctShape,ctPenWidth,ctPenStyle,ctJoinStyle,ctLineCap];