Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Diagram Pan and scroll using only Mouse Middle button! (Read 2701 times)
MikeHeal
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 20
Joined: Feb 5th, 2020
Diagram Pan and scroll using only Mouse Middle button!
Apr 8th, 2020 at 10:42pm
Print Post  
Hello,

Is there a way by which we can pan and scroll together using the mouse middle button (only) !?

Used the code:
diag.Behavior = Behavior.Pan;

but it just changes the mode to Pan, we still have to additionally use Left mouse button to Scroll. Can we combine them to just Middle mouse button !  Huh

Thanks.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Diagram Pan and scroll using only Mouse Middle button!
Reply #1 - Apr 9th, 2020 at 5:30am
Print Post  
Hi,

You can pan with middle button by setting diagram.MiddleButtonActions = MouseButtonActions.Pan; I'm not sure what's the difference between pan and scroll inferred in your post. If you mean ScrollVewer should scroll using middle button, see e.g. https://stackoverflow.com/questions/5426232/how-can-i-make-wpf-scrollviewer-midd...

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
MikeHeal
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 20
Joined: Feb 5th, 2020
Re: Diagram Pan and scroll using only Mouse Middle button!
Reply #2 - Apr 9th, 2020 at 6:26pm
Print Post  
Hello Slavcho,
Thanks for the reply.

diagram.MiddleButtonActions = MouseButtonActions.Pan; puts the diagram in Pan mode. Now, in order to pan/scroll (move/drag) the diagram we Have to use Left mouse key, which i wanted to avoid.

I tried the StackOverflow's solution, that doesn't give a smooth experience.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Diagram Pan and scroll using only Mouse Middle button!
Reply #3 - Apr 10th, 2020 at 4:44am
Print Post  
Hi,

MiddleButtonActions = Pan should let you pan with middle button without changing Behavior to Pan - the left button will keep doing whatever it does in other Behavior modes you keep it set to - e.g. select items in SelectOnly.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
MikeHeal
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 20
Joined: Feb 5th, 2020
Re: Diagram Pan and scroll using only Mouse Middle button!
Reply #4 - Apr 10th, 2020 at 4:58pm
Print Post  
Ok. May be i am doing something wrong on my side.
I tried:

..
diagram.MouseDown += OnMouseDown;
diagram.MouseUp += OnMouseUp;
..

private void OnMouseDown(object sender, MouseButtonEventArgs e)
{
if (e.MiddleButton == MouseButtonState.Pressed)
diagram.MiddleButtonActions = MouseButtonActions.Pan;
}


private void OnMouseUp(object sender, MouseButtonEventArgs e)
{
if (e.MiddleButton == MouseButtonState.Released)
diagram.MiddleButtonActions = MouseButtonActions.None;
}


But, this didn't help.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Diagram Pan and scroll using only Mouse Middle button!
Reply #5 - Apr 11th, 2020 at 7:53am
Print Post  
MiddleButtonActions value is checked from PreviewMouseDown, so before you can toggle it in mouse events. That code doesn't make much sense anyway, why node keep the Pan value set at all times?
  
Back to top
 
IP Logged
 
MikeHeal
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 20
Joined: Feb 5th, 2020
Re: Diagram Pan and scroll using only Mouse Middle button!
Reply #6 - Apr 13th, 2020 at 6:06pm
Print Post  
Roll Eyes
Thanks for the help Slavcho.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint