Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Unprecise ZoomFactor (Read 4170 times)
baron
YaBB Newbies
*
Offline


1001001001

Posts: 42
Joined: Dec 2nd, 2007
Unprecise ZoomFactor
Dec 2nd, 2007 at 2:09pm
Print Post  
Due to the zoomfactor being a Long and not a Double, it is impossible to zoom the chart precisely. For example, to always make it fill 100% of the screen - sometimes you need a zoom factor of 8.5 but it gets rounded off to 8 and therefore it shows empty margins. I suppose this is the reason why ZoomToFit also leaves margins?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Unprecise ZoomFactor
Reply #1 - Dec 3rd, 2007 at 8:31am
Print Post  
Actually ZoomToFit leaves some empty margins intentionally. You can zoom more precisely using the following method:

float rx = (float)cntWidth / ctrlWidth;
float ry = (float)cntHeight / ctrlHeight;
float ratio = max(rx, ry);

put_ZoomFactor(SHORT(100 / ratio));
ScrollTo(cntX, cntY);

Here ctrlWidth/Height are the width and height of the FlowChartX window in pixels, and cntWidth/Height is the diagram content size in pixels, i.e. the rectangle that bounds all nodes and links.

Stoyan
  
Back to top
 
IP Logged
 
baron
YaBB Newbies
*
Offline


1001001001

Posts: 42
Joined: Dec 2nd, 2007
Re: Unprecise ZoomFactor
Reply #2 - Dec 3rd, 2007 at 11:34am
Print Post  
That worked - thanks!

I suppose I should have mentioned though that I assumed this was a bug due to the Overview component. Is there an equivalent way to remove margins in the Overview? FitAll=true always adds margins and the algorithm I came up with didn't help.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Unprecise ZoomFactor
Reply #3 - Dec 3rd, 2007 at 11:57am
Print Post  
The Overview's FitAll mode fits the flowchart area as it has been set through SetDocSize, and there might be some margins between your outermost nodes and the document border. Call the FitDocToObjects method to see if more precise flowchart bounds will fix that.

Stoyan
  
Back to top
 
IP Logged
 
baron
YaBB Newbies
*
Offline


1001001001

Posts: 42
Joined: Dec 2nd, 2007
Re: Unprecise ZoomFactor
Reply #4 - Dec 3rd, 2007 at 1:13pm
Print Post  
I played with the Doc Size and tried setting the Overview ScaleFactor manually using several methods but I couldn't get the precision I need. Maybe I'm doing something wrong.

Keep in mind that my Overview window is very small (100 pixels) so, for example, when I need a scale factor of 8.5, this gets rounded to 8 and margins get added.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Unprecise ZoomFactor
Reply #5 - Dec 3rd, 2007 at 2:04pm
Print Post  
Ok then, it is a rounding error if the overview is so small. Perhaps it will help if the overview size is proportional to the flowchart document size.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint