Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Panning vs Zooming (Read 3081 times)
x-fgi
YaBB Newbies
*
Offline



Posts: 35
Joined: Aug 14th, 2009
Panning vs Zooming
Aug 25th, 2009 at 8:38am
Print Post  
Hello Stoyo,
When I perform a new layout operation, sometims occurs that some boxes go out of visible bounds.
I try to use the best fit to zoom, let's say... it works, but I do not want to zoom when there is enouth room to view all the nodes!
I thought: why I cannot move all node ( i.e. panning) so that the center of the diagram will result in the center of my visible area?

So that, I try to write my own bestFit procedure:
First I found a rectangle that can contain all nodes, by finding the min (top, left) and the max(bottom,right) of all nodes; then I calculate the offset (x and y) between the center of the visible area and the center of my min-max rectangle;
then.... I try to move oll the nodes by this offset.

This solution works Cheesy ....but only if there are no group /subordinate nodes, Embarrassed
because in this case some node are moved twice or more, with the result that the layout is changed in shape....

I even thought to try to select all nodes.....then mode them together... as I could manually do... but I found no Selection.moveto method... Cry

any suggestion?

best regards
Franco
  

Franco
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Panning vs Zooming
Reply #1 - Aug 25th, 2009 at 11:05am
Print Post  
Hi Franco,

You could call FitDocToObjects after running the layout method. If you prefer moving the nodes, you could do that only for ones whose MasterGroup is null/nothing. That should ensure child nodes are not moved more than once.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
x-fgi
YaBB Newbies
*
Offline



Posts: 35
Joined: Aug 14th, 2009
Re: Panning vs Zooming
Reply #2 - Aug 25th, 2009 at 12:47pm
Print Post  
FitDocToObjects....
How did I not saw it?
That's works fine!!
CheesyGREAT!!!! Cheesy

Well, The Demo I was preparing was therefore good enougth!
I show the demo to my boss, he has been VERY impressed! Shocked
He said me we will buy a licence in the very next day. 8)
Thank you very much for your co-operation !
Franco
  

Franco
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Panning vs Zooming
Reply #3 - Aug 25th, 2009 at 1:06pm
Print Post  
you're welcome 8)
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint