Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Scrollbars Issue (Read 4878 times)
priyanka
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Sep 2nd, 2009
Scrollbars Issue
Dec 4th, 2009 at 2:09pm
Print Post  
Hi,

I am sending a sample for the issue on your support email subjected Scroll bar Issue.

The issue I am facing is
1.) when i scroll(Zoom in) the diagram using MouseWheel the scroll bars are not getting updated accordingly so that I am not able to see certain nodes of the diagram.

2.) When we drag the node from one place to another in diagram then,
When we drag any node to extreme right it moves slowly and that can be observed easily but
if we move the node to the left it moves so fast and also moves to a greater distance in a samll move.

What could be the solution to both the problems.

Thanks,
Priyanka

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Scrollbars Issue
Reply #1 - Dec 5th, 2009 at 1:19pm
Print Post  
Change your SetZoom method to this:

Code
Select All
public void SetZoom(double percentage)
{
	var diagramTransform = scrollViewer.TransformToVisual(diagram.DocumentPlane);

	// this point should remain centered when zooming in?
	Point scrollViewerCenter = new Point(
		scrollViewer.ActualWidth / 2, scrollViewer.ActualHeight / 2);
	Point diagramPointAtViewCenter = diagramTransform.Transform(scrollViewerCenter);

	diagram.ZoomFactor = Math.Max(10, Math.Min(percentage, 200));

	Rect clientAreaSize = new Rect(0, 0, scrollViewer.ActualWidth, scrollViewer.ActualHeight);
	Rect clientAreaDiagSize = diagram.ClientToDoc(clientAreaSize);

	// ensure the diagram is always larger than the scrollviewer
	Rect newBounds = GetContentBounds();
	double diffX = Math.Max(0, clientAreaDiagSize.Width - newBounds.Width);
	double diffY = Math.Max(0, clientAreaDiagSize.Height - newBounds.Height);
	newBounds.Inflate(diffX / 2, diffY / 2);
	diagram.Bounds = newBounds;

	// make sure the diagram center is at the scrollviewer center
	diagram.ScrollX = diagramPointAtViewCenter.X - clientAreaDiagSize.Width / 2;
	diagram.ScrollY = diagramPointAtViewCenter.Y - clientAreaDiagSize.Height / 2;
}
 



Stoyan
  
Back to top
 
IP Logged
 
priyanka
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Sep 2nd, 2009
Re: Scrollbars Issue
Reply #2 - Dec 7th, 2009 at 9:06am
Print Post  
Hi,

Thanks,
It solves the first problem I was facing.

Any inputs related to the second issue in the previous post.

And also one more issue..
For that please do the followng changes in the sample provided..

in .xaml file:
After column definition for the grid.

Code
Select All
<GridSplitter x:Name="splitter" Background="AliceBlue" Width="10" ResizeDirection="Auto"/>
 




in .cs file:
In Window() at the end and berfore setting the column for diagram:

Code
Select All
Grid.SetColumn(splitter, 2);
 



After doing the needful changes, run the application.

The issue is:When we resize the column using the grid splitter the diagram to not fit the entire content area and some blank space is seen.

What could be done so that diagram expands itself as per the space available.

Thanks,


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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Scrollbars Issue
Reply #3 - Dec 7th, 2009 at 12:22pm
Print Post  
Hi,

We can't find any reason why auto-scrolling to the left is faster (or it might be auto-resize). Our developer will research this for the next release.

I guess you could handle the scrollviewers' SizeChanged event and call SetZoom(ZoomFactor) from the handler to make sure the diagram fills the scrollviewer area again.

Stoyan
  
Back to top
 
IP Logged
 
priyanka
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Sep 2nd, 2009
Re: Scrollbars Issue
Reply #4 - Dec 7th, 2009 at 12:42pm
Print Post  
Hi,

Thanks for your reply.

Can you please let know when is the next official release for the build in which thiss issue will be looked for...!!!


Thanks,

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Scrollbars Issue
Reply #5 - Dec 7th, 2009 at 12:52pm
Print Post  
In January 2010.
  
Back to top
 
IP Logged
 
priyanka
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Sep 2nd, 2009
Re: Scrollbars Issue
Reply #6 - Dec 7th, 2009 at 3:39pm
Print Post  
Hi,

For the same sample sent to you..
When the application starts, the first method called to set the entire diagram is FillClientArea().

When the application is up the scrollbars do not come at the center, they are always on the extreme top(vertically) and extreme left(horizontally).

What code changes need to be done to set  scrollbar at the center in FillClientArea().

Thanks,
Priyanka
  
Back to top
 
IP Logged
 
priyanka
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Sep 2nd, 2009
Re: Scrollbars Issue
Reply #7 - Dec 8th, 2009 at 6:29am
Print Post  
Hi,

When adding

Code
Select All
var diagramTransform = scrollViewer.TransformToVisual(diagram.DocumentPlane); 



somtimes we are getting the following exception message:
"The specified Visual and this Visual do not share a common ancestor, so there is no valid transformation between the two Visuals."

Can you please provide some inputs on what the problem could be and what need to be done to solve the problem.

Thanks,
Priyanka
  
Back to top
 
IP Logged
 
priyanka
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Sep 2nd, 2009
Re: Scrollbars Issue
Reply #8 - Dec 9th, 2009 at 5:30am
Print Post  
Any inputs on the previous two posts..!!!!!

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Scrollbars Issue
Reply #9 - Dec 9th, 2009 at 1:53pm
Print Post  
In Window1_Loaded try calling this instead of FillClientArea:

diagram.ZoomToRect(GetContentBounds());
SetZoom(diagram.ZoomFactor);

At what point are you getting that "do not share a common ancestor" exception? If it's while the application loads, it might be that the xaml hasn't been fully loaded yet and the visual tree is not ready for use.
  
Back to top
 
IP Logged
 
priyanka
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Sep 2nd, 2009
Re: Scrollbars Issue
Reply #10 - Dec 9th, 2009 at 2:08pm
Print Post  
Hi,

Thanks for the reply.

But the required changes are also not setting the horizontal and vertical scrollbars a the center.Sad

And the exception do not share a common ancestor is in the case when trying to open a new instance for the same window.

Please provide inputs.

Thanks,
Priyanka
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Scrollbars Issue
Reply #11 - Dec 9th, 2009 at 2:38pm
Print Post  
Yes, they do. But if you expect that to work also from the 'divide area' handler, call scrollViewer.UpdateLayout() before the SetZoom method, or otherwise the scrollviewer's ActualWidth and ActualHeight values won't be correct.

What do you mean by a new instance of the same window? Are you using DiagramViews to display the same Diagram in multiple windows?
  
Back to top
 
IP Logged
 
priyanka
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Sep 2nd, 2009
Re: Scrollbars Issue
Reply #12 - Dec 9th, 2009 at 2:59pm
Print Post  
Hi Stoyo,

Many thanks for such quick reply.

As you described I had placed

diagram.ZoomToRect(GetContentBounds());
SetZoom(diagram.ZoomFactor);

in Window1_Loaded() but the scroll bars are still at the same positions.
Also I had made the change in the 'divide area' handler and checked, again the same behaviour of scroll bars...Sad

In case when the zoom factor for diagram is more than 100 then using the SetZoom() the scroll bars do come at the center but not able to place them at the center in case of initial load.
Please provide some inputs.

And thanks for providing a pointer that the exception can be thrown if the window is not completely loaded. It had solved my problem.
I had moved my code to window loaded and now all is working fine.

Many thanks again....Smiley

But please provide some inputs on the scrollbar positon issue.!!!

Thanks,
Priyanka
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Scrollbars Issue
Reply #13 - Dec 10th, 2009 at 1:28pm
Print Post  
Are you sure some code later doesn't change the scroll position? I can't even see scrollbars with only these two lines in the Loaded handler because the diagram fits into the scrollviewer.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint