Simple Graph Demo - Link/Line length

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

Simple Graph Demo - Link/Line length

Postby Athabasca » February 7th, 2009, 10:27 am

Hello Kambiz,

I have a problem in the Simple Graph Demo:
A Link/Line placed on startpoint X=1 or Y=1 can no longer be reduced by select the endpoint.

Can you help?

I use Version 2.72
Attachments
SG_LinkLine.png
SG_LinkLine.png (4.21 KiB) Viewed 1795 times
User avatar
Athabasca
Active Member
Active Member
 
Posts: 15
Joined: January 30th, 2009, 10:55 am
Location: Germany

Re: Simple Graph Demo - Link/Line length

Postby Kambiz » February 7th, 2009, 10:11 pm

I took a look at the bug and found its origin. But it is not easy to fix because needs some major changes on logic behind dragging.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: Simple Graph Demo - Link/Line length

Postby madfish » February 21st, 2009, 2:58 pm

you can fix this problem by modify the code as following:

Code: Select all
procedure TSimpleGraph.PerformDragBy(dX, dY: Integer);
var
  I: Integer;
  Mobility: TObjectSides;
  MinX, MinY: Integer; // by qlg
begin
  if Assigned(DragSource) and ((dX <> 0) or (dY <> 0)) then
  begin
    Mobility := [];
    for I := 0 to DraggingObjects.Count - 1 do
      Mobility := Mobility + DraggingObjects[I].QueryMobility(DragHitTest);
    GraphConstraints.SourceRect := DraggingBounds;
    //------------------ commented by qlg begin
    //if not GraphConstraints.ConfineOffset(dX, dY, Mobility) then
    //  Exit;
    //------------------ commented by qlg end
    BeginUpdate;
    try
      MinX := 0;
      MinY := 0;
      for I := 0 to DraggingObjects.Count - 1 do
      begin
        DraggingObjects[I].OffsetHitTest(DragHitTest, dX, dY);
        MinX := Min(MinX, DraggingObjects[I].BoundsRect.Left); // added by qlg
        MinY := Min(MinY, DraggingObjects[I].BoundsRect.Top);  // added by qlg
      end;

      //------------------by qlg begin
      if (MinX < 0) and (MinY < 0) then
        for I := 0 to Objects.Count - 1 do
          Objects[I].OffsetHitTest(GHT_BODY_MASK, -MinX, -MinY)
      else
      if MinX < 0 then
        for I := 0 to Objects.Count - 1 do
          Objects[I].OffsetHitTest(GHT_BODY_MASK, -MinX, 0)
      else
      if MinY < 0 then
        for I := 0 to Objects.Count - 1 do
          Objects[I].OffsetHitTest(GHT_BODY_MASK, 0, -MinY)
      //------------------by qlg end
    finally
      EndUpdate;
    end;
    Inc(fDragTargetPt.X, dX);
    Inc(fDragTargetPt.Y, dY);
    ScrollInView(fDragTargetPt);
  end;
end;
madfish
Member
Member
 
Posts: 1
Joined: February 20th, 2009, 3:51 pm

Re: Simple Graph Demo - Link/Line length

Postby Athabasca » February 21st, 2009, 5:31 pm

Not quite true. A rectangle moves down when the line on top applied.
User avatar
Athabasca
Active Member
Active Member
 
Posts: 15
Joined: January 30th, 2009, 10:55 am
Location: Germany

Re: Simple Graph Demo - Link/Line length

Postby Athabasca » March 1st, 2009, 11:44 am

Pity that this did not further elaborated.
User avatar
Athabasca
Active Member
Active Member
 
Posts: 15
Joined: January 30th, 2009, 10:55 am
Location: Germany


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 2 guests

cron