Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic MouseEnter Event. (Read 3894 times)
Shane
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: Mar 26th, 2009
MouseEnter Event.
Mar 26th, 2009 at 10:33am
Print Post  
Hi All,

I need nodes on the diagram to enlarge by a fixed size on mouse enter event. I been able to do that for nodes which have no other nodes attached to them.

Can someone please tell me how can I incorporate this functionality when there is a node attached to the main node. While doing this the main node and attached node's alignment should not get distorted.
The main node is decision shaped and the attached node is rectangular.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: MouseEnter Event.
Reply #1 - Mar 26th, 2009 at 11:45am
Print Post  
Hi,

If you are enlarging the nodes by setting their Bounds, you could use the AttachTo(x, y, w, h) method to attach the rectangle to the decision. These arguments specify percents of the main node width and height, and if you resize the main node, the attached node size will change too.

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


I love YaBB 1G - SP1!

Posts: 24
Joined: Mar 26th, 2009
Re: MouseEnter Event.
Reply #2 - Mar 26th, 2009 at 1:47pm
Print Post  
Hi Stoyan,

Thanks for the suggestion but I am unable to make it work.

Following is the code I used to resolve the issue :

if (i.SubordinateGroup != null && i.SubordinateGroup.AttachedNodes[0] != null)
{
var a = i.SubordinateGroup.AttachedNodes[0];

double mainWidth = i.Bounds.Width + ((i.Bounds.Width / diagram.ZoomFactor) * 100);
double mainHieght = i.Bounds.Height + ((i.Bounds.Height / diagram.ZoomFactor) * 100);
double xa = ((x / mainWidth) * 100);
double ya = (((y + mainHieght) / mainHieght) * 100);
double nodeHeight = ((15 / mainHieght) * 100);
a.AttachTo(i, xa, ya, 100, nodeHeight);

}

Any suggestion what I am missing.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: MouseEnter Event.
Reply #3 - Mar 26th, 2009 at 3:16pm
Print Post  
Hi Shane,

You should not attach the node again while the mouse moves, I think the control will ignore this anyway unless you call Detach() first. You should just use that AttachTo overloaded method when creating the group, instead the AttachToNode.some_corner variation.

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


I love YaBB 1G - SP1!

Posts: 24
Joined: Mar 26th, 2009
Re: MouseEnter Event.
Reply #4 - Mar 27th, 2009 at 1:43pm
Print Post  
Hi,

I am still not able to make it right.

The code is as follows :

double mainWidth = mainNode.Bounds.Width + ((mainNode.Bounds.Width / diagram.ZoomFactor) * 100);
           double mainHieght = mainNode.Bounds.Height + ((mainNode.Bounds.Height / diagram.ZoomFactor) * 100);
           double xa = ((mainNode.Bounds.X / mainWidth) * 100);
           double ya = (((mainNode.Bounds.Y + mainHieght) / mainHieght) * 100);
           double nodeHeight = ((15 / mainHieght) * 100);


           labelNode.AttachTo(mainNode, xa, ya, 100, nodeHeight);

I think iam doing mistake in the argument calculation for the AttachTo method.

Can you please help me here and tell what is wrong with the code.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: MouseEnter Event.
Reply #5 - Mar 27th, 2009 at 2:33pm
Print Post  
You should call this AttachTo method only once, when creating the group, and its arguments should not depend on the ZoomFactor. They should specify percents of the main node's width and height. So labelNode.AttachTo(mainNode, 50, 0, 100, 100) will make the label always occupy the righthand half of the main node. When you enlarge mainNode, the labelNode's Bounds will be recalculated to match the new size of the main node.

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


I love YaBB 1G - SP1!

Posts: 24
Joined: Mar 26th, 2009
Re: MouseEnter Event.
Reply #6 - Mar 29th, 2009 at 10:13am
Print Post  
Hi,

If i need the attached node also to zoom with the main node on mouse enter event.

Any suggestion how to do that.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: MouseEnter Event.
Reply #7 - Mar 30th, 2009 at 6:45am
Print Post  
Hi,

If you set a larger Bounds of the main node, the attached node's Bounds will be automatically enlarged with the same ratio. Or you are zooming the main node by setting its RenderTransform?

Stoyan
  
Back to top
 
IP Logged
 
Shane
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: Mar 26th, 2009
Re: MouseEnter Event.
Reply #8 - Mar 30th, 2009 at 8:52am
Print Post  
Hi,

We are using RectAnimation class for the bubble zoom purpose.

The new bounds are being calculated by me following way :

     double x = (45 + xinflate - mainNode.Bounds.Width) / 2;


double y = (45 + yinflate - mainNode.Bounds.Height) / 2;


x = x + ((x / diagram.ZoomFactor) * 100);


y = y + ((y / diagram.ZoomFactor) * 100);

Do the AttachTo property work here too. If not any suggestion how can I do this.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: MouseEnter Event.
Reply #9 - Mar 30th, 2009 at 12:43pm
Print Post  
You should not do anything else if the RectAnimation changes mainNode.Bounds and labelNode has been attached using the AttachTo(main, x1,y1,x2,y2) method.

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