- Welcome, Guest. Please Login or Register
MindFusion  
  We have released initial version of MindFusion.Scheduling library for HTML5 & JavaScript.  
  HomeHelpSearchLoginRegister   
     
     
   
 
Page Index Toggle Pages: 1 Send Topic Print  
keyboard event to move selected node position
Read 152 times

quintin_wang   Offline
YaBB Newbies
*
Posts: 2
I Love MindFusion!


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

 
IP Logged    
 
     

Slavcho   Offline
God Member
*****
Posts: 1395
Gender: male
tech.support


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

Code:
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
 
 
 
IP Logged    
 
     

quintin_wang   Offline
YaBB Newbies
*
Posts: 2
I Love MindFusion!


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