Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Zoomfactor (Read 5343 times)
dku
YaBB Newbies
*
Offline



Posts: 41
Joined: Jun 5th, 2008
Zoomfactor
Jun 16th, 2008 at 7:18am
Print Post  
Hello,

I've a diagram inside a user control that can resize. When resizing, I set the Bounds of the diagram. My method Apply layout is computing the spaces between layers (layered layout) but could take some time.

So, to have a smooth resize, I've try to implement a zoomed diagram and after some delay, the layout is performed.

But when I'm setting the ZoomFactor, the bounds are changed ?

Code
Select All
private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e) {
		double l_OldWidth = myGraphicalExplorerDiagram.Bounds.Width;
		myGraphicalExplorerDiagram.Bounds = new Rect(0, 0, e.NewSize.Width, e.NewSize.Height);
		myGraphicalExplorerDiagram.ZoomFactor *= (e.NewSize.Width / l_OldWidth);
		m_ResizeDispatcherTimer.Stop();
		m_ResizeDispatcherTimer.Start();
	  }

	  void ResizeDispatcherTimerHandler(object sender, EventArgs e) {
		m_ResizeDispatcherTimer.Stop();
		myGraphicalExplorerDiagram.ZoomFactor = 100;
		this.ApplyLayout();
	  } 



Thanks for any hint.
Bye
Didier
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Zoomfactor
Reply #1 - Jun 16th, 2008 at 7:48am
Print Post  
Setting ZoomFactor will change the size of the diagram control to Bounds * ZoomFactor / 100, but should not change the Bounds value, if that's what you mean?

Stoyan
  
Back to top
 
IP Logged
 
dku
YaBB Newbies
*
Offline



Posts: 41
Joined: Jun 5th, 2008
Re: Zoomfactor
Reply #2 - Jun 16th, 2008 at 8:51am
Print Post  
Hello,

Visually I see the diagram changing its size, it is probably what you say, the diagram control bounds are changed.

The property Bounds is not setting the diagram control size ?

Any idea on how I can achieve my goal ? (that the diagram is resizing with the user control containing it by redrawing only - relayout will occur later through dispatcher)

By the way, it could be fine to have a zoom factor per axis (x - y).

Thanks
Didier

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Zoomfactor
Reply #3 - Jun 16th, 2008 at 9:30am
Print Post  
Hello,

The final size of the control depends on three properties - Bounds, MeasureUnit, ZoomFactor. Bounds is scaled by the MeasureUnit to WPF point ratio to find the non-zoomed size, and then by ZoomFactor / 100 to find the zoomed size. I could not understand what exactly are you trying to achieve?

Stoyan
  
Back to top
 
IP Logged
 
dku
YaBB Newbies
*
Offline



Posts: 41
Joined: Jun 5th, 2008
Re: Zoomfactor
Reply #4 - Jun 16th, 2008 at 11:04am
Print Post  
Hello,

I've a diagram control in a resizable area (grid, with splitter).

I'm using the layered layout to arrange my diagram, computing the layer distance according to the width available.


So, I want the following behavior :
- Once diagram resized, I arrange the elements using layered layout with new computed layout distance
- WHEN resizing, I cannot arrange the elements, it takes too longer. So I've thought using the zoom factor to adapt the diagram to the new size. I want to follow the resize as a better feedback experience to the user.

Thanks
Didier





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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Zoomfactor
Reply #5 - Jun 16th, 2008 at 1:41pm
Print Post  
There is a ZoomTiFit method in our Windows Forms control, and it should help you do what you need. We'll port it to WPF later this week.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Zoomfactor
Reply #6 - Jun 18th, 2008 at 1:35pm
Print Post  
This version adds the ZoomToFit and ZoomToRect methods:
https://mindfusion.eu/_beta/wpfdiag101pre.zip

The Diagram must be placed inside a ScrollViewer for them to work correctly.

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