Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Zooming on Node while MouseEnter (Read 2574 times)
Bala
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 156
Joined: Apr 21st, 2009
Zooming on Node while MouseEnter
Apr 22nd, 2009 at 6:36am
Print Post  
Hi,

I want Zooming on node while MouseEnter, I have used double animation by using this reference

http://mindfusion.eu/Forum/YaBB.pl?board=wpfdg_disc;action=display;num=123994983...

Its working, the only thing which I want additionally is "The node should be zoomed while mouse is on the node, while mouseLeave from node then only zoom-out should be done."

Regards,
Bala
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Zooming on Node while MouseEnter
Reply #1 - Apr 22nd, 2009 at 9:27am
Print Post  
Remove the sb.AutoReverse = true line, and start the reverse animation from the mouse-leave handler.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Bala
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 156
Joined: Apr 21st, 2009
Re: Zooming on Node while MouseEnter
Reply #2 - Apr 22nd, 2009 at 12:15pm
Print Post  
Hi Stoyan,

I have removed sb.AutoReverse = true line and written this code for mouse-leave handler.
Code
Select All
node123 = e.Source as DiagramNode;

	     ScaleTransform scale = new ScaleTransform();
	     scale.CenterX = node123.Bounds.X - node123.Bounds.Width / 2;
	     scale.CenterY = node123.Bounds.Y - node123.Bounds.Height / 2;

	     originalTransform = node123.RenderTransform;
	     TransformGroup tg = new TransformGroup();
	     tg.Children.Add(originalTransform);
	     tg.Children.Add(scale);
	     node123.RenderTransform = tg;

	     var xa = new DoubleAnimation(2, 1, new Duration(new TimeSpan(0, 0, 0, 0, 500)));
	     var ya = new DoubleAnimation(2, 1, new Duration(new TimeSpan(0, 0, 0, 0, 500)));

	     if (diagram.FindName("mouseLeave") != null)
		   diagram.UnregisterName("mouseLeave");
	     diagram.RegisterName("mouseLeave", scale);

	     Storyboard.SetTargetName(xa, "mouseLeave");
	     Storyboard.SetTargetProperty(xa, new PropertyPath("ScaleX"));
	     Storyboard.SetTargetName(ya, "mouseLeave");
	     Storyboard.SetTargetProperty(ya, new PropertyPath("ScaleY"));

	     var sb = new Storyboard();
	     //sb.AutoReverse = true;
	     sb.Children.Add(xa);
	     sb.Children.Add(ya);
	     sb.Completed += new EventHandler(sb_Completed);
	     sb.Begin(diagram); 



But its not working.Node is still zooming even on mouse leave.Where I need to make correction in this code to work it out ?


Regards,
Bala
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Zooming on Node while MouseEnter
Reply #3 - Apr 22nd, 2009 at 1:06pm
Print Post  
Are you sure the MouseEnter animation has stopped? Try forcing it by calling Storyboard.Stop().
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Zooming on Node while MouseEnter
Reply #4 - Apr 23rd, 2009 at 2:17pm
Print Post  
Yes, I have tried...But have some problem.
Could you plz send reverse code for mouseLeave?
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint