Bladeren bron

fix update on click vector original

johann 5 jaren geleden
bovenliggende
commit
5267f98eca
2 gewijzigde bestanden met toevoegingen van 26 en 9 verwijderingen
  1. 6 2
      lazpaint/tools/utoolvectorial.pas
  2. 20 7
      lazpaintcontrols/lcvectororiginal.pas

+ 6 - 2
lazpaint/tools/utoolvectorial.pas

@@ -1207,16 +1207,20 @@ begin
     begin
       case GetEditMode of
       esmShape, esmNoShape:
+        if not FDownHandled then
         begin
           m := AffineMatrixInverse(Manager.Image.LayerOriginalMatrix[Manager.Image.CurrentLayerIndex]);
           zoom := (VectLen(m[1,1],m[2,1])+VectLen(m[1,2],m[2,2]))/2/Manager.Image.ZoomFactor;
           BindOriginalEvent(true);
           try
-            GetVectorOriginal.MouseClick(m*FLastPos, DoScaleX(PointSize, OriginalDPI)*zoom);
+            if GetVectorOriginal.MouseClick(m*FLastPos, DoScaleX(PointSize, OriginalDPI)*zoom) then
+            begin
+              handled := true;
+              result := OnlyRenderChange;
+            end;
           finally
             BindOriginalEvent(false);
           end;
-          if Assigned(GetVectorOriginal.SelectedShape) then handled := true;
         end;
       esmGradient:
         begin

+ 20 - 7
lazpaintcontrols/lcvectororiginal.pas

@@ -364,7 +364,7 @@ type
     procedure SelectShape(AShape: TVectorShape); overload;
     procedure DeselectShape;
     function GetShapesCost: integer;
-    procedure MouseClick(APoint: TPointF; ARadius: single);
+    function MouseClick(APoint: TPointF; ARadius: single): boolean;
     procedure Render(ADest: TBGRABitmap; ARenderOffset: TPoint; AMatrix: TAffineMatrix; ADraft: boolean); override;
     procedure ConfigureEditor(AEditor: TBGRAOriginalEditor); override;
     function CreateEditor: TBGRAOriginalEditor; override;
@@ -2623,23 +2623,36 @@ begin
     inc(result, Shape[i].GetGenericCost);
 end;
 
-procedure TVectorOriginal.MouseClick(APoint: TPointF; ARadius: single);
+function TVectorOriginal.MouseClick(APoint: TPointF; ARadius: single): boolean;
 var
   i: LongInt;
 begin
   for i:= FShapes.Count-1 downto 0 do
     if FShapes[i].PointInShape(APoint) then
     begin
-      SelectShape(i);
-      exit;
+      if SelectedShape <> FShapes[i] then
+      begin
+        SelectShape(i);
+        exit(true);
+      end else
+        exit(false);
     end;
   for i:= FShapes.Count-1 downto 0 do
     if FShapes[i].PointInShape(APoint, ARadius) then
     begin
-      SelectShape(i);
-      exit;
+      if SelectedShape <> FShapes[i] then
+      begin
+        SelectShape(i);
+        exit(true);
+      end else
+        exit(false);
     end;
-  DeselectShape;
+  if SelectedShape <> nil then
+  begin
+    DeselectShape;
+    exit(true);
+  end else
+    exit(false);
 end;
 
 procedure TVectorOriginal.Render(ADest: TBGRABitmap; ARenderOffset: TPoint; AMatrix: TAffineMatrix;