Problem when Flipping Horizontally a block with diagramStudio

Hello
The Attached Screenshot below shows what happens when I try to make a horizontal flip for a block by code. However I noticed that the problem occurs only when Originalrect.right is set to 100 at the creation of the block.
image

I believe the problem arises from the Procedure inside Direct2dClasses...

procedure TD2DBlockDrawer.Flip(APath: TDgrGraphicsPath);
var
Center: TD2DPoint2f;
TransMatrix: TD2DMatrix3x2F;
X, Y: Single;
begin
TransMatrix := D2DCanvas.FTransMatrix;
Center.x := 50;
Center.y := 50;
if HorizontalFlip then
X := -1
else
X := 1;
if VerticalFlip then
Y := -1
else
Y := 1;
TD2DGraphicsPath(APath).TransMatrix := TD2DMatrix3x2F.Scale(X, Y, Center) * TransMatrix;
end;

When I replace CenterX:=50 by CenterX:=Real centerx of my block every thing goes well.
I believe the same issue is with Centery when trying to flip vertically.
Please how can I solve this problem?
Thanks in advance

Does the problem happen when using GDI+?
Can you please provide a sample project reproducing the issue, with the specific code of your block?

Thank you.
As a matter of fact, I could solve the problem by making changes on the procedure inside Direct2dClasses:
procedure TD2DBlockDrawer.Flip(APath: TDgrGraphicsPath);
var
Center: TD2DPoint2f;
TransMatrix: TD2DMatrix3x2F;
X, Y: Single;
begin
TransMatrix := D2DCanvas.FTransMatrix;
Center.x :=(Self.SourceRect.Right-Self.SourceRect.Left)/2;// Replacing 50; ...
Center.y :=(Self.SourceRect.Bottom-Self.SourceRect.Top)/2;// Replacing 50;
if HorizontalFlip then X := -1 else X := 1;
if VerticalFlip then Y := -1 else Y := 1;
TD2DGraphicsPath(APath).TransMatrix := TD2DMatrix3x2F.Scale(X, Y, Center) * TransMatrix;
end;
Here is the sample done with Delphi 10seatle vcl

Test.zip (5.6 KB)

I also noticed that linkpoints of the block did not flipped neither. I had to make changes inside atDiagram unit:
procedure TCustomDiagramBlock.SetHorizontalFlip(const Value: boolean);
var i:Integer;
begin
if FHorizontalFlip <> Value then
begin
FHorizontalFlip := Value;
Redraw;
//Update LinkPoints
for i:=0 to LinkPoints.Count-1 do
LinkPoints[i].OrX:=(Self.OriginalRect.Right-Self.OriginalRect.Left)-LinkPoints[i].OrX;
end;
end;

Now Every thing is going well in my program

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.