Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic ResizeToFitItems and drag drop (Read 2197 times)
ChrisGC
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 10
Joined: Jul 2nd, 2010
ResizeToFitItems and drag drop
Jul 2nd, 2010 at 5:21pm
Print Post  
Hi,

I am evaluating diagramlite. I have a project whereby i am creating nodes and links programatically followed by LayeredLayout.Arrange, diagram.ResizeToFitItems and diagram.ZoomToRect:

[code] var layout = new LayeredLayout(MindFusion.Diagramming.Silverlight.Layout.Orientation.Vertical, 80, 250, new Size(10, 10));
layout.LinkType = LayeredLayoutLinkType.Cascading;
layout.Arrange(diagram);
diagram.ResizeToFitItems(5);
diagram.ZoomToRect(diagram.Bounds);
[/code]

I also have a code based on the drag/drop sample which allows me to manipulate the nodes.

However due to diagram.ResizeToFitItems and diagram.ZoomToRect the drag hit test is not accurate. ([b]it is without those method calls[/b]). It seems to be failing here:

[code]

void diagram_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
ShapeNode node = diagram.GetNodeAt(e.GetPosition(diagram)) as ShapeNode;

if (node == null)
return;
[/code]

i.e diagram.GetNodeAt(e.GetPosition(diagram)) is no longer accurate and dispite clicking on a node, GetNodeAt returns null....

This can all be seen be adding the following to the drag drop demo:

[code] private void diagram_NodeCreated(object sender, NodeEventArgs e)
{
diagram.ResizeToFitItems(5);
diagram.ZoomToRect(diagram.Bounds);
}
[/code]

and adding the attribut on the diagram markup:

NodeCreated="diagram_NodeCreated"

Please can you advise?

Thanks in advance
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ResizeToFitItems and drag drop
Reply #1 - Jul 2nd, 2010 at 5:25pm
Print Post  
Hi,

Try using e.GetPosition(diagram.DocumentPlane) instead.

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


I love YaBB 1G - SP1!

Posts: 10
Joined: Jul 2nd, 2010
Re: ResizeToFitItems and drag drop
Reply #2 - Jul 2nd, 2010 at 5:51pm
Print Post  
Stoyo - perfect!!!

Thanks for the quick response.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint