Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Please come in, maybe this is a bug (Read 2855 times)
CanadaProgrammer
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 113
Joined: Jun 30th, 2011
Please come in, maybe this is a bug
Jul 31st, 2012 at 11:16pm
Print Post  
There 2 buttons, A and B.
The click event of A is to append a ShapeNode to a diagram
The click event of B is call the method ResizeToFitItems of Diagram,

You will find location of the shape is changed. why???
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Please come in, maybe this is a bug
Reply #1 - Aug 1st, 2012 at 6:50am
Print Post  
The on-screen location of all nodes might change if the diagram's origin changes and it's no longer in the view's current scroll range, e.g. if the new node is the left-most or top-most in the diagram and you call ResizeToFitItems. If you allow the diagram to only grow this shouldn't happen - instead of calling the Resize method, set diagram.Bounds to the union of current Bounds value and diagram.GetContentBounds().

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
CanadaProgrammer
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 113
Joined: Jun 30th, 2011
Re: Please come in, maybe this is a bug
Reply #2 - Aug 2nd, 2012 at 12:37am
Print Post  
Looks it can work, but I still have a question. Let's call method GetContentBounds like below:

RectangleF rectContent = this.diagram1.GetContentBounds(false, false);

In my case, the value of rectContent.X is -2, and the value of rectContent.Y is -2. but diagram.Bounds.Location.X is 0, diagram.Bounds.Location.Y is 0. Why can method GetContentBounds return (-2, -2) ?
  
Back to top
 
IP Logged
 
CanadaProgrammer
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 113
Joined: Jun 30th, 2011
Re: Please come in, maybe this is a bug
Reply #3 - Aug 2nd, 2012 at 12:41am
Print Post  
By the way, the whole node is visible on diagram completely, i mean every point that contained by the node is on client area of diagram and is visible
  
Back to top
 
IP Logged
 
CanadaProgrammer
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 113
Joined: Jun 30th, 2011
Re: Please come in, maybe this is a bug
Reply #4 - Aug 2nd, 2012 at 2:08am
Print Post  
In my case, I click button A to add a node, then click button B to call then method. do nothing between clicking button A and clicking button B
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Please come in, maybe this is a bug
Reply #5 - Aug 2nd, 2012 at 6:25am
Print Post  
CanadaProgrammer wrote on Aug 2nd, 2012 at 12:37am:
Looks it can work, but I still have a question. Let's call method GetContentBounds like below:

RectangleF rectContent = this.diagram1.GetContentBounds(false, false);

In my case, the value of rectContent.X is -2, and the value of rectContent.Y is -2. but diagram.Bounds.Location.X is 0, diagram.Bounds.Location.Y is 0. Why can method GetContentBounds return (-2, -2) ?


GetContentBounds returns the union of GetRepaintRect() results. GetRepaintRect adds AdjustmentHandlesSize to the node's Bounds so that selection handles are included too in the diagram/repaint area. If you don't wish to include them, just create the union of Bounds of all items.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint