Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic keyboard event to move selected node position (Read 1970 times)
quintin_wang
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 2
Joined: Feb 6th, 2018
keyboard event to move selected node position
Feb 6th, 2018 at 5:51am
Print Post  
how to listen keyboard event to move selected node position, (bounds), and link also auto change, like mouse drag selected node action.
  

2018-02-06_140619.png ( 19 KB | 154 Downloads )
2018-02-06_140619.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: keyboard event to move selected node position
Reply #1 - Feb 6th, 2018 at 6:18am
Print Post  
node.setBounds(rect, true) should also move attached links. Try something like this -

Code
Select All
document.onkeydown = function (e)
{
    var diagram = Diagram.find('diagram');

    //move left
    if (e.keyCode == 37 && e.ctrlKey)
    {
        if (diagram.getActiveItem())
        {
            var item = diagram.getActiveItem();
            if (item.setBounds)
            {
                var r = item.getBounds().clone();
                r.offset(-10, 0);
                item.setBounds(r, true);
            }
        }
    }
} 



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


I Love MindFusion!

Posts: 2
Joined: Feb 6th, 2018
Re: keyboard event to move selected node position
Reply #2 - Feb 6th, 2018 at 6:27am
Print Post  
Yes, it is working fine for me, thanks a lot.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint