Page Index Toggle Pages: 1 [2]  Send TopicPrint
Hot Topic (More than 10 Replies) Zoom feature (Read 10715 times)
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Zoom feature
Reply #15 - Aug 14th, 2014 at 12:18pm
Print Post  
Replacing ZoomFactor will be a very breaking change for many customers which we don't intend to do any time soon, so please stop requesting and try to adapt to the ScaleTransform method. One way we can see to make that Xaml layout to work the same as with ZoomFactor is to set fixed size for the ScrollViewer:

Code
Select All
scroller.Width = SystemInformation.PrimaryMonitorSize.Width;
scroller.Height = SystemInformation.PrimaryMonitorSize.Height;
 



Another possible way should be to override the MeasureOverride method (e.g. in MyDiagram class above) and divide the base size by current x/y scales.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Zoom feature
Reply #16 - Aug 14th, 2014 at 12:41pm
Print Post  
Actually with that specific Xaml, setting RenderTransform instead of LayoutTransform seems to work same way as ZoomFactor without fixing ScrollViewer size, so that's a third option.

If you are still using scrolling to present multiple screens in your application as in old test project I have from you, note that you will need the new ScrollX/Y properties from MyDiagram sample above to get expected scroll positions. You might also check the DiagramDocument / DiagramPage classes added by version 3 of the control, they implement built-in support for multiple pages and you could avoid the ScrollViewer and scrolling altogether.
  
Back to top
 
IP Logged
 
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Re: Zoom feature
Reply #17 - Aug 14th, 2014 at 2:11pm
Print Post  
Your solution work in the example i sent, but not in my software.

The example I sent no idea if is related to exact trouble i have, i think yes but now see no.


Nothing I test fix thiis yet.

Instead modify zoomfactor what i suggest is craate new one
ZoomAspectRatio

In that way not broke compatibility, is the same just add
ZoomAspectRatio.FactorX
ZoomAspectRatio.FactorY


About scroll after zoom, that is already solved and working with zoom, is very easy.
The page solution on versión 3.0 is good but broken compatibility with my prevous diagram and features in the software.

I continue researching, thanks for your time, but please try add that feature.



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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Zoom feature
Reply #18 - Aug 15th, 2014 at 12:28pm
Print Post  
We really cannot implement non-uniform scale in short term as it would affect many controls included in wpf diagram. What we can do at this time is let you override the diagram's method that applies MeasureUnit and ZoomFactor transforms:
https://mindfusion.eu/_beta/wpfdiag32.zip

As long as you don't need support for this in misc. components like the ruler and overview, you should be able to apply your extra Y scale like this:

Code
Select All
public class MyDiagram : Diagram
{
	protected override Matrix DocumentToDiagramMatrix
	{
		get
		{
			var m = base.DocumentToDiagramMatrix;
			m.Scale(1, 1.5);
			return m;
		}
	}
} 



If that still does not work in your application, then you are probably using the non-uniform scales incorrectly in some custom-drawing or layout code, and having separate builtin properties for x/y zoom would not help you anyway.
  
Back to top
 
IP Logged
 
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Re: Zoom feature
Reply #19 - Aug 15th, 2014 at 6:17pm
Print Post  
Thanks for your help! I check this soon.

Sorry for my ignorance but how apply/use this class?
« Last Edit: Aug 15th, 2014 at 7:46pm by PDM. »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Zoom feature
Reply #20 - Aug 18th, 2014 at 8:13am
Print Post  
Replace the <diag:Diagram> element in your xaml file with a <MyDiagram> one:

Code
Select All
<Window ...
    xmlns:my="clr-namespace:MyNamespace"

    <my:MyDiagram ...> 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Re: Zoom feature
Reply #21 - Aug 18th, 2014 at 10:55am
Print Post  
public class MyDiagram : Diagram
{
protected override Matrix DocumentToDiagramMatrix
{
get
{
var m = base.DocumentToDiagramMatrix;
m.Scale(0.8, 0.8);
return m;
}
}
}

Faster test and work perfect like i need doing any aspect ratio.!
Sorry again, but how call the class now from C# code


MyDiagram myzoom = new MyDiagram();
myzoom ?

Thanks for your help, sorry for my ignorance.
When the beta text can be removed?


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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Zoom feature
Reply #22 - Aug 18th, 2014 at 12:22pm
Print Post  
If the diagram parent derives from ContentControl, set its Content property:

Code
Select All
scrollViewer.Content = myzoom; 



If it derives from Panel, add the diagram to its Children collection:

Code
Select All
grid.Children.Add(myzoom); 



I hope the helps,
Stoyan
  
Back to top
 
IP Logged
 
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Re: Zoom feature
Reply #23 - Aug 18th, 2014 at 3:45pm
Print Post  
I only have a mínimum trouble with scroll.
Checking what  happen.
« Last Edit: Aug 18th, 2014 at 5:59pm by PDM. »  
Back to top
 
IP Logged
 
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Re: Zoom feature
Reply #24 - Aug 18th, 2014 at 5:23pm
Print Post  
Oh Stoyo.
Apologize for large POST!

100% working, no any issue, just few more corrections from my side.

Working like a charm!!!

Thanks again, just need remove the beta TEXT.

Kiss

THANKS AGAIN!!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 
Send TopicPrint