Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Establishing ZoomLimits using ZoomToRect (Read 1846 times)
kaykay15
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 43
Joined: Mar 11th, 2010
Establishing ZoomLimits using ZoomToRect
Dec 14th, 2010 at 3:48pm
Print Post  
Hello Stoyon,

It has been a long long time i've posted in this fourm.... The Mindfusion diagramming component was a perfect match for our requirement.. Our applicaiton has just crossed the beta stage and is live now, you can view it now @ http://www.ravencloud.com
Cheers Mindfusion team.

The thing i came back here is; we need to set the zoom limits for the diagram. We are using the diagram.ZoomToRect() method for zooming, Currently if we allow the end user to zoom with out limit; there is a performance issue as the application is getting slowed down.
So now we need to limit the zooming level of the diagram.

i have tried to reset the zoomlimit to 200 if the zoomlimit is greater than 200 after ZoomToRect() method.

It is limiting the zoomlevel but not centering the selected region; is there any way to center the selected region and limit the zoom factor of the diagram?

Thanks,
-KayKay
  

Thanks,&&-KayKay
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Establishing ZoomLimits using ZoomToRect
Reply #1 - Dec 14th, 2010 at 4:35pm
Print Post  
Congratulations 8)

You could call ZoomToRect again for easier centering. It should look something like this:

Code
Select All
diagram.ZoomToRect(rect);
if (diagram.ZoomFactor > 200)
{
	double ratio = diagram.ZoomFactor / 200;
	double w = rect.Width * ratio;
	double h = rect.Height * ratio;
	double dx = w - rect.Width;
	double dy = h - rect.Height;
	rect.X -= dx / 2;
	rect.Y -= dy / 2;
	rect.Width = w;
	rect.Height = h;
	diagram.ZoomToRect(rect);
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
kaykay15
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 43
Joined: Mar 11th, 2010
Re: Establishing ZoomLimits using ZoomToRect
Reply #2 - Dec 16th, 2010 at 7:55am
Print Post  
Works like a charm!
Stoyon... You Rock...
  

Thanks,&&-KayKay
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint