From: Marco W. <in...@ca...> - 2005-02-25 08:53:56
|
Pavel, Since you're the first merging developer at this moment, perhaps you can find some space and time to insert this routine. It's been posted earlier in an email to Stefan (I think), and has been extended a little so that if a node is scrolled to the right or bottom the scrollbars move with it, keeping it visible. The same goes for dragging it to the top or left, than it moves all other controls to the bottom right... Marco. There you go: procedure TSimpleGraph.DoCanMoveResizeNode(Node: TGraphNode; var aLeft, aTop, aWidth, aHeight: Integer; var CanMove, CanResize: Boolean); var i: integer; Delta: TPoint; R: TRect; begin if FreezeTopLeft then begin if aLeft < 0 then aLeft := 0; if aTop < 0 then aTop := 0; end else begin { MeW: scroll other nodes to the bottom right if a node is scrolled beyond the topleft } if (aLeft < Left) or (aTop < Top) then begin Delta := Point(0,0); if (aLeft < Left) then Delta.X := -aLeft; if (aTop < Top) then Delta.Y := -aTop; BeginUpdate; try for i:=0 to ObjectsCount-1 do begin if (not Objects.Items[i].Selected) and (Objects.Items[i] <> Node) and (TGraphNodeExt(Objects.Items[i]).Parent = nil) then begin R := Objects[i].BoundsRect; OffsetRect(R, Delta.X, Delta.Y); Objects[i].BoundsRect := R; end; end; if (aLeft < Left) then aLeft := 0; if (aTop < Top) then aTop := 0; finally EndUpdate; end; end; { MeW: scroll right and/or bottom if required } if (aLeft + Width > VisibleBounds.Right) or (aTop + Height > VisibleBounds.Bottom) then ScrollInView(Node); end; if Assigned(OnCanMoveResizeNode) then OnCanMoveResizeNode(Self, Node, aLeft, aTop, aWidth, aHeight, CanMove, CanResize); end; |